public async Task <ActionResult <Report> > Get(int year, int month, string subscription) { if (!Guid.TryParse(subscription, out Guid subscriptionId)) { return(BadRequest("please provide a valid subscription id format")); } IList <Request> requests; try { requests = await _requestsService.GetBy(year, month, subscriptionId); } catch (HttpRequestException hre) { return(BadRequest("An error occured when trying to reach the request data collector: " + hre.Message)); } catch (Exception) { return(BadRequest()); } if (requests == null || !requests.Any()) { return(NotFound("The provided subscription has no requests for the provided year and month")); } var report = _reporter.CreateReportFromRequests(requests, subscriptionId); return(Ok(report)); }