public bool Update(object item) { Ration rat = (Ration)item; Ration copy = (Ration)_ration.Clone(); _ration.Name = rat.Name; _ration.Ingredients = rat.Ingredients; try { repo.Update(_ration); repo.Save(); NotifyPropertyChanged(); return(true); } catch (DbUpdateException ex) { Backup(_ration, copy); return(false); } }