public bool AddOrUpdateAutodeskFile(AutodeskFile file, bool overwrite, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
     var fileRepo = new AutodeskFileRepository(context);
     var existingFile = fileRepo.GetByNameAndOwner(file.Name, file.MC_OwnerId);
     if (existingFile == null)
     {
         fileRepo.InsertFile(file);
     }
     else
     {
         existingFile.TypeCatalogHeader = file.TypeCatalogHeader;
         fileRepo.UpdateFile(existingFile);
     }
     return true;
 }
 public AutodeskFile GetAutodeskFile(string fileName, string ownerName, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
         var fileRepo = new AutodeskFileRepository(context);
         return fileRepo.GetByNameAndOwner(fileName, ownerName);
 }
 public AutodeskFile GetAutodeskFileById(int family, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
         var fileRepo = new AutodeskFileRepository(context);
         return fileRepo.GetByID(family);
 }
 public bool AddTypeToFile(Item item, string fileName, string owner, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
         var fileRepo = new AutodeskFileRepository(context);
         var existingFile = fileRepo.GetByNameAndOwner(fileName, owner);
         if (existingFile != null)
         {
             var itemRepo = new ItemRepository(context);
             var existingItem = itemRepo.GetByNameAndAutodeskFileName(fileName, item.Name, owner);
             if (existingItem == null)
             {
                 fileRepo.AddItem(item, existingFile);
                 return true;
             }
             Log.Error(string.Format("Item Not Added:{0} {1}", item.Name, fileName));
             //Should never occur - Deleting all Items on File update.
         }
         return false;
 }