private void OnNavToMonthView(CostBreakdown breakdown)
 {
     try
     {
         if (breakdown != null)
         {
             IEnumerable <Transaction> viewTransactions = _transactionRepository.GetTransactionsByMonth(breakdown.TimePeriod);
             _monthlyCostsViewModel.SetTransactions(viewTransactions);
             _monthlyCostsViewModel.SetBreakdown(breakdown);
             CurrentViewModel = _monthlyCostsViewModel;
         }
         else
         {
             WpfMessageBox.ShowDialog("Warning", "No transaction data available for the current month.", MessageBoxButton.OK, MessageIcon.Information);
         }
     }
     catch (Exception ex)
     {
         WpfMessageBox.ShowDialog("Error", ex.Message, MessageBoxButton.OK, MessageIcon.Error);
     }
 }
 private void UpdateViewModels()
 {
     try
     {
         _monthlyCostsViewModel.SetTransactions(_transactionRepository.GetTransactionsByMonth(DateTime.Today));
         _yearlyCostsViewModel.SetTransactions(_transactionRepository.GetTransactionsByYear(DateTime.Today.Year));
         _yearlyCostsViewModel.SetBreakdown(_transactionRepository.GetYearCostBreakdowns().Where(b => b.TimePeriod.Year == DateTime.Today.Year).FirstOrDefault());
         _allCostsViewModel.SetTransactions(_transactionRepository.GetTransactions());
         _allCostsViewModel.SetBreakdown(_transactionRepository.GetLifetimeCostBreakdown());
         _transactionsViewModel.SetTransactions(_transactionRepository.GetTransactions());
         _vendorsViewModel.SetVendors(_vendorRepository.GetVendors());
         MonthCostData = new ObservableCollection <CostBreakdown>(_transactionRepository.GetMonthCostBreakdowns());
         IEnumerable <CostBreakdown> costData = _transactionRepository.GetMonthCostBreakdowns();
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         WpfMessageBox.ShowDialog("Data Error", ex.Message, MessageBoxButton.OK, MessageIcon.Error);
     }
 }