protected void exportAssetLinks(PortletDataContext portletDataContext) throws Exception {

    Document document = SAXReaderUtil.createDocument();

    Element rootElement = document.addElement("links");

    Element exportDataRootElement = portletDataContext.getExportDataRootElement();

    try {
      portletDataContext.setExportDataRootElement(rootElement);

      ActionableDynamicQuery linkActionableDynamicQuery =
          _assetLinkLocalService.getExportActionbleDynamicQuery(portletDataContext);

      linkActionableDynamicQuery.performActions();

      for (long linkId : portletDataContext.getAssetLinkIds()) {
        AssetLink assetLink = _assetLinkLocalService.getAssetLink(linkId);

        StagedAssetLink stagedAssetLink =
            ModelAdapterUtil.adapt(assetLink, AssetLink.class, StagedAssetLink.class);

        portletDataContext.addClassedModel(
            portletDataContext.getExportDataElement(stagedAssetLink),
            ExportImportPathUtil.getModelPath(stagedAssetLink),
            stagedAssetLink);
      }
    } finally {
      portletDataContext.setExportDataRootElement(exportDataRootElement);
    }

    portletDataContext.addZipEntry(
        ExportImportPathUtil.getRootPath(portletDataContext) + "/links.xml",
        document.formattedString());
  }
  @Override
  public List<StagedAssetLink> fetchStagedModelsByUuidAndCompanyId(String uuid, long companyId) {

    DynamicQuery dynamicQuery =
        getAssetLinkDynamicQuery(
            companyId, 0, parseAssetEntry1Uuid(uuid), parseAssetEntry2Uuid(uuid));

    dynamicQuery.addOrder(OrderFactoryUtil.desc("linkId"));

    List<AssetLink> assetLinks = _assetLinkLocalService.dynamicQuery(dynamicQuery);

    return ModelAdapterUtil.adapt(assetLinks, AssetLink.class, StagedAssetLink.class);
  }
  protected StagedAssetLink fetchExistingAssetLink(
      long groupId, String assetEntry1Uuid, String assetEntry2Uuid) {

    DynamicQuery dynamicQuery =
        getAssetLinkDynamicQuery(0, groupId, assetEntry1Uuid, assetEntry2Uuid);

    List<AssetLink> assetLinks = _assetLinkLocalService.dynamicQuery(dynamicQuery);

    if (ListUtil.isNotEmpty(assetLinks)) {
      return ModelAdapterUtil.adapt(assetLinks.get(0), AssetLink.class, StagedAssetLink.class);
    }

    return null;
  }