public async Task <IActionResult> GetDebts() { 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}" }))); } var debts = await _debtService.GetDebtsByUserIdAsync(userId); if (debts == null) { return(NotFound(new ErrorResponse(new ErrorModel { Message = $"There is no debt" }))); } return(Ok(new Response <IList <DebtResponse> >(_mapper.Map <IList <DebtResponse> >(debts)))); }