public ActionResult <ItemsResponse <AverageMerchantRating> > GetAvgMerchantRatings() { ActionResult result = null; try { List <AverageMerchantRating> ratingList = _ratingsService.GetAvgMerchantRatings(); if (ratingList == null) { result = NotFound404(new ErrorResponse("You do not have any merchant ratings to display")); } else { ItemsResponse <AverageMerchantRating> resp = new ItemsResponse <AverageMerchantRating>(); resp.Items = ratingList; result = Ok200(resp); } } catch (Exception ex) { Logger.LogError(ex.ToString()); result = StatusCode(500, new ErrorResponse(ex.Message.ToString())); } return(result); }