private void ConvertMediaFile(MediaFile mediaFile, FileToSyncItemConfiguration path)
 {
     if (File.Exists(path.Destination.FullPath + PathUtils.Extension))
     {
         SyncItem parent = SyncItemProvider.GetSyncItem(path.Destination.FullPath + PathUtils.Extension);
         string   name   = String.IsNullOrEmpty(Path.GetFileNameWithoutExtension(mediaFile.Name))
             ? mediaFile.Name
             : Path.GetFileNameWithoutExtension(mediaFile.Name);
         string syncItemPath = Path.Combine(path.Destination.FullPath, name + PathUtils.Extension);
         if (File.Exists(syncItemPath))
         {
             SyncItem syncItem = SyncItemProvider.GetSyncItem(syncItemPath);
             if (mediaFile.Blob != syncItem.SharedValues[FileTemplateFields.Blob.FieldId])
             {
                 syncItem.AttachMediaFile(new FileInfo(mediaFile.FilePath));
                 syncItem = _serializationManager.UpdateStatistics(syncItem);
                 SyncItemProvider.SaveSyncItem(syncItem, syncItemPath);
             }
         }
         else
         {
             SyncItem item = _serializationManager.CreateSyncMediaItem(parent.ItemPath, path.Destination.Database, parent.ID, mediaFile.FilePath);
             SyncItemProvider.SaveSyncItem(item, syncItemPath);
         }
     }
 }
        public void AttachFileToSerializationItem(string itemPath, string filePath)
        {
            SyncItem syncItem = SyncItemProvider.GetSyncItem(itemPath);

            syncItem.AttachMediaFile(new FileInfo(filePath));
            SyncItemProvider.SaveSyncItem(syncItem, itemPath);
        }
        public SyncItem CreateSyncMediaItem(string itemPath, string database, string parentID, string filePath)
        {
            FileInfo fileInfo     = new FileInfo(filePath);
            var      templatePath = MediaTypeResolver.Instance.GetTemplate(fileInfo.Extension.TrimStart('.'), false);
            string   name         = Path.GetFileNameWithoutExtension(fileInfo.Name);
            SyncItem syncItem     = CreateSyncItem(name, database, itemPath, parentID, templatePath);

            syncItem.AttachMediaFile(fileInfo);
            return(syncItem);
        }