private void DoFavourite(DateTime datetime) { MessageBox.Show("The purchase was added to favourite parchases", "Access token", MessageBoxButton.OK, MessageBoxImage.Information); surrogatePurchase = new Surrogate<Purchase>(new PurchaseServiceProxy()); foreach (var purch in Purchases.Where(purch => purch.PurchaseDate == datetime)) { purch.Favorite = true; surrogatePurchase.Update(surrogatePurchase.Serialize(purch)); return; } }