public async Task <IActionResult> CreateCredit([FromBody] CreditRequest request)
        {
            var userId = User.Claims.FirstOrDefault(c => c.Type == "id").Value;

            // check if user exists
            var userExists = await _identityService.CheckIfUserExists(userId);

            if (!userExists)
            {
                return(NotFound(new ErrorResponse(new ErrorModel {
                    Message = $"There is no user with id: {userId}"
                })));
            }

            // check if new credit budgetId is correct
            var budget = await _budgetService.GetBudgetAsync(request.BudgetId);

            if (budget == null)
            {
                return(NotFound(new ErrorResponse(new ErrorModel {
                    Message = $"There is no budget with id: {request.BudgetId}"
                })));
            }

            if (budget.UserId != userId)
            {
                return(Forbid());
            }

            // create credit
            var newCredit = await _creditService.NewCreditAsync(request, userId);

            if (newCredit == null)
            {
                return(BadRequest(new ErrorResponse(new ErrorModel {
                    Message = "Could not create new credit"
                })));
            }

            var locationUri = _uriService.GetCreditUri(newCredit.Id);

            return(Created(locationUri, new Response <CreditResponse>(_mapper.Map <CreditResponse>(newCredit))));
        }