public Guid AddStorage(BiblosDS.Library.Common.Objects.DocumentStorage Storage) { Storage.IdStorage = Guid.NewGuid(); using (Model.BiblosDS2010Entities db = new Model.BiblosDS2010Entities(BiblosDSConnectionString)) { Model.Storage entityStorage = Storage.TryToConvertTo <Model.Storage>(db); if (Storage.StorageType != null) { entityStorage.IdStorageType = Storage.StorageType.IdStorageType; } if (Storage.Server != null && Storage.Server.IdServer != Guid.Empty) { entityStorage.IdServer = Storage.Server.IdServer; } db.AddToStorage(entityStorage); db.SaveChanges(); } return(Storage.IdStorage); }