public async Task UpdateBudgetAsync(Guid id) { if (!_budgetRepository.IsBudgetExist(id)) { throw new ServiceExceptions(ServiceErrorCodes.BudgetNotExist, "Budget object not exist"); } var budget = await _budgetRepository.GetAsync(id); budget.SetTotalIncome(_incomeRepository.CalculateTotalIncome(id)); budget.SetTotalExpense(_expenseRepository.CalculateTotalExpense(id)); budget.SetBudgetAmount(budget.TotalIncome - budget.TotalExpense); await _budgetRepository.UpdateAsync(budget); }