public async Task <IActionResult> PeopleStats() { try { var countTask = peopleService.CountAsync(); var nameStatsTask = peopleService.NameStatsAsync(); await Task.WhenAll(countTask, nameStatsTask); var stats = new Stats() { TotalPeople = await countTask, NameStats = await nameStatsTask }; return(this.Ok(stats)); } catch (Exception ex) { logger.LogError(1500, ex, $"An error occurred while attempting to list people. URL: {Request.GetEncodedPathAndQuery()}"); return(StatusCode(500, new { Message = SystemError })); } }