public async Task <IActionResult> AddNewGoal([FromBody] CreateGoalRequestModel goalCreateRequestModel) { try { System.Threading.Thread.Sleep(1000); var goalExists = await _goalRepository.GoalExists(goalCreateRequestModel.GoalName); if (goalExists) { return(BadRequest(new ApiResponseBadRequestResult() { ErrorMessage = $"Goal {goalCreateRequestModel.GoalName} already exists" })); } var newGoal = await _goalRepository.AddGoal(_mapper.Map <Goal>(goalCreateRequestModel)); return(Ok(new ApiResponseOKResult() { Data = newGoal })); } catch (Exception ex) { _logger.LogError(ex, "Failed to create new goal"); return(StatusCode((int)HttpStatusCode.InternalServerError, new ApiResponseFailure() { ErrorMessage = "Failed to create new goal" })); } }