/**
  * @return KalturaAttachmentClientPlugin
  */
 public static function get(KalturaClient $client)
 {
     if (!self::$instance) {
         self::$instance = new KalturaAttachmentClientPlugin($client);
     }
     return self::$instance;
 }
 private function handleAttachmentAsset($entryId, SimpleXMLElement $attachment)
 {
     $attachmentPlugin = KalturaAttachmentClientPlugin::get($this->xmlBulkUploadEngine->getClient());
     $attachmentAsset = new KalturaAttachmentAsset();
     $attachmentAsset->tags = $this->xmlBulkUploadEngine->implodeChildElements($attachment->tags);
     $this->xmlBulkUploadEngine->impersonate();
     //needed since $this->xmlBulkUploadEngine->getAssetParamsId calles to unimpersonate
     if (isset($attachment->fileExt)) {
         $attachmentAsset->fileExt = $attachment->fileExt;
     }
     if (isset($attachment->description)) {
         $attachmentAsset->partnerDescription = $attachment->description;
     }
     if (isset($attachment->filename)) {
         $attachmentAsset->filename = $attachment->filename;
     }
     if (isset($attachment->title)) {
         $attachmentAsset->title = $attachment->title;
     }
     if (isset($attachment['format'])) {
         $attachmentAsset->format = $attachment['format'];
     }
     $attachmentAssetId = null;
     if (isset($attachment['attachmentAssetId'])) {
         $attachmentAssetId = $attachment['attachmentAssetId'];
     }
     if ($attachmentAssetId) {
         $attachmentPlugin->attachmentAsset->update($attachmentAssetId, $attachmentAsset);
     } else {
         $attachmentAsset = $attachmentPlugin->attachmentAsset->add($entryId, $attachmentAsset);
         $attachmentAssetId = $attachmentAsset->id;
     }
     $attachmentAssetResource = $this->xmlBulkUploadEngine->getResource($attachment, 0);
     if ($attachmentAssetResource) {
         $attachmentPlugin->attachmentAsset->setContent($attachmentAssetId, $attachmentAssetResource);
     }
 }