public ContactMaster EditContact(ContactMaster contactToEdit) { try { // Get original contact var originalContact = GetContact(contactToEdit.ID); // Save changes if (originalContact != null) { _entities.Entry(originalContact).CurrentValues.SetValues(contactToEdit); } _entities.SaveChanges(); } catch (Exception ex) { throw ex; } return(contactToEdit); }