public async Task <IActionResult> GetEventRunCount([FromQuery] int athleteId) { var response = new SingleModelResponse <double>() as ISingleModelResponse <double>; try { if (athleteId < 1) { throw new Exception("Athlete Id is missing"); } response.Model = await Task.Run(() => { double eventCount = -1; eventCount = _context.GetEventRunCount(athleteId); if (eventCount < 0) { throw new Exception("Run does not exist"); } return(eventCount); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }