public void RemovePayee(Payee payee)
 {
     using (DeferEvents())
     {
         ReplacePayee(oldPayee: payee, newPayee: null);
         Payees.Remove(payee);
         RaiseDatabaseChanged();
     }
 }
        public void DeleteItem()
        {
            Payee itemToDelete;

            //1. Get Account from DB
            using (var ctx = new EntitySaveItContext())
            {
                itemToDelete =
                    ctx.Payees.FirstOrDefault(s => s.Id == SelectedItem.Id);
            }

            //Create new context for disconnected scenario
            using (var newContext = new EntitySaveItContext())
            {
                newContext.Entry(itemToDelete).State = System.Data.Entity.EntityState.Deleted;

                try
                {
                    newContext.SaveChanges();
                }
                catch (Exception ex)
                {
                    // TODO review this exception
                    Console.WriteLine(ex);
                    MessageBox.Show("Cannot delete this item");
                }
            }

            // remove the item to be deleted from the list
            if (SelectedItem.IsPayee)
            {
                Payees.Remove(SelectedItem);
            }
            else
            {
                Payers.Remove(SelectedItem);
            }
        }