/**
  * Converts the given $objectXml to an AssetInterface instance and returns it
  *
  * @param \SimpleXMLElement $objectXml
  * @param string $className the concrete class name of the AssetInterface to create
  * @return AssetInterface
  * @throws NeosException
  */
 protected function importAsset(\SimpleXMLElement $objectXml, $className)
 {
     if (isset($objectXml['__identifier'])) {
         $asset = $this->assetRepository->findByIdentifier((string) $objectXml['__identifier']);
         if (is_object($asset)) {
             return $asset;
         }
     }
     $resourceHash = (string) $objectXml->resource->hash;
     $resourceData = trim((string) $objectXml->resource->content);
     if ((string) $objectXml->resource['__identifier'] !== '') {
         $resource = $this->persistenceManager->getObjectByIdentifier((string) $objectXml->resource['__identifier'], 'TYPO3\\Flow\\Resource\\Resource');
     }
     if (!isset($resource) || $resource === null) {
         $resource = $this->importResource((string) $objectXml->resource->filename, $resourceHash !== '' ? $resourceHash : null, !empty($resourceData) ? $resourceData : null, (string) $objectXml->resource['__identifier'] !== '' ? (string) $objectXml->resource['__identifier'] : null);
     }
     $asset = $this->objectManager->get($className);
     $asset->setResource($resource);
     $this->assetService->getRepository($asset)->add($asset);
     return $asset;
 }