public async Task <NbaPlayerSearchViewModel> BuildPlayerSearchViewModelFromSearchTerm(string searchTerm)
        {
            var viewModel = new NbaPlayerSearchViewModel()
            {
                SearchTerm = searchTerm
            };

            try
            {
                var searchResults = await _playersClient.SearchPlayersAsync(searchTerm, _config.GetValue <string>("NbaApiKey"));

                if (searchResults.data.Any())
                {
                    viewModel.Results = searchResults.data.ToList();
                }
                else
                {
                    viewModel.ErrorMessage = "No results when searching for: " + searchTerm;
                }
            }catch (HttpRequestException httpEx)
            {
                viewModel.ErrorMessage = "Player search API call failed: " + httpEx.Message;
                //logger.Error(httpEx);
            }
            catch (JsonException jsonEx)
            {
                viewModel.ErrorMessage = "Error deserializing JSON: " + jsonEx.Message;
                //logger.Error(jsonEx);
            }

            return(viewModel);
        }
        public async Task <ActionResult> Search(NbaPlayerSearchViewModel search)
        {
            var viewModel = await _nbaPlayerSearchModelBuilder.BuildPlayerSearchViewModelFromSearchTerm(search.SearchTerm);

            return(View("PlayerSearch", viewModel));
        }