public async Task <ActionResult> DeleteBudgetGroup(int budgetGroupId)
        {
            string email = HttpContext.User.RetrieveEmailFromClaimsPrincipal();

            User user = await _userManager.Users.FirstOrDefaultAsync(u => u.Email == email);

            if (user == null)
            {
                _logger.LogError($"Unable to find User with the email '{email}'.");
                return(NotFound());
            }

            int userId = user.Id;

            BudgetGroup budgetGroup = await _repo.GetBudgetGroupByIdForUserAsync(budgetGroupId, userId);

            if (budgetGroup == null)
            {
                _logger.LogError($"Unable to find BudgetGroup with the BudgetGroupId '{budgetGroupId}' for user with the user Id '{userId}'.");
                return(NotFound());
            }

            await _repo.DeleteBudgetGroupByIdForUserAsync(budgetGroupId);

            BudgetGroupDto budgetGroupDto = _mapper.Map <BudgetGroupDto>(budgetGroup);

            _logger.LogInformation($"Deleted BudgetGroup with the BudgetGroupId '{budgetGroupId}' for user with the user Id '{userId}'.");
            return(NoContent());
        }
        public async Task <ActionResult> PostBudgetGroup(BudgetGroupForCreationDto budgetGroupForCreationDto)
        {
            string email = HttpContext.User.RetrieveEmailFromClaimsPrincipal();

            User user = await _userManager.Users.FirstOrDefaultAsync(u => u.Email == email);

            if (user == null)
            {
                _logger.LogError($"Unable to find User with the email '{email}'.");
                return(NotFound());
            }

            int userId = user.Id;

            string budgetGroupTitle = budgetGroupForCreationDto.BudgetGroupTitle;

            BudgetGroup budgetGroupForUser = new BudgetGroup(userId, budgetGroupTitle);
            await _repo.AddBudgetGroupForUserAsync(budgetGroupForUser);

            BudgetGroupDto budgetGroupDto = _mapper.Map <BudgetGroupDto>(budgetGroupForUser);

            _logger.LogInformation($"Created BudgetGroup with the BudgetGroupId '{budgetGroupDto.BudgetGroupId}'for user with user Id '{userId}'.");
            return(CreatedAtRoute(nameof(GetBudgetGroupForUser), new { budgetGroupId = budgetGroupDto.BudgetGroupId }, budgetGroupDto));
        }