private void btnAddPayment_Click(object sender, RoutedEventArgs e)
 {
     AddPayment AddPayment = new AddPayment(ViewModel.SelectedHome, null);
     bool? result = AddPayment.ShowDialog();
     if(result == true)
     {
         DuePayment dp = AddPayment.ViewModel.CreatePayment();
         if (dp != null)
         {
             ViewModel.CreateDuePayment(dp);
         }
         ViewModel.HydrateHomeInvoices();
     }
 }
 private void btnEditPayment_Click(object sender, RoutedEventArgs e)
 {
     if (ViewModel.SelectedHomeInvoice == null) return;
     using(var context = Persistence.Persistence.CreateContext())
     {
         var DuePayment = context.DuePayments.Where(d => d.DuePaymentsId == ViewModel.SelectedHomeInvoice.DuePaymentId).FirstOrDefault();
         if(DuePayment != null)
         {
             AddPayment AddPayment = new AddPayment(ViewModel.SelectedHome, DuePayment);
             bool? result = AddPayment.ShowDialog();
             if(result == true)
             {
                 DuePayment dp = AddPayment.ViewModel.CreatePayment();
                 if (dp != null)
                 {
                     ViewModel.UpdateDuePayment(dp);
                 }
                 ViewModel.HydrateHomeInvoices();
             }
         }
     }
 }