public RegisteredCategory Update(UpdateCategory updateRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var categoryToUpdate = updateRegistry.ToEntity(); logisticDataContext.Categories.Attach(categoryToUpdate); logisticDataContext.Entry(categoryToUpdate).State = System.Data.Entity.EntityState.Modified; logisticDataContext.SaveChanges(); return(categoryToUpdate.toDTO()); } }