/**
  * @param CaptionAsset $captionAsset
  * @param string $fullPath
  * @param bool $copyOnly
  */
 protected function attachFile(CaptionAsset $captionAsset, $fullPath, $copyOnly = false)
 {
     $ext = pathinfo($fullPath, PATHINFO_EXTENSION);
     $captionAsset->incrementVersion();
     $captionAsset->setFileExt($ext);
     $captionAsset->setSize(filesize($fullPath));
     $captionAsset->save();
     $syncKey = $captionAsset->getSyncKey(CaptionAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     try {
         kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, $copyOnly);
     } catch (Exception $e) {
         if ($captionAsset->getStatus() == CaptionAsset::ASSET_STATUS_QUEUED || $captionAsset->getStatus() == CaptionAsset::ASSET_STATUS_NOT_APPLICABLE) {
             $captionAsset->setDescription($e->getMessage());
             $captionAsset->setStatus(CaptionAsset::ASSET_STATUS_ERROR);
             $captionAsset->save();
         }
         throw $e;
     }
     $finalPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     list($width, $height, $type, $attr) = getimagesize($finalPath);
     $captionAsset->setWidth($width);
     $captionAsset->setHeight($height);
     $captionAsset->setSize(filesize($finalPath));
     $captionAsset->setStatus(CaptionAsset::ASSET_STATUS_READY);
     $captionAsset->save();
 }