public async Task <SearchResponse> Handle(SearchQuery query) { var searchResponse = new SearchResponse { Page = query.Page, SearchTerm = query.SearchTerm, SearchType = query.SearchType }; try { query.SearchTerm = query.SearchTerm.Replace("/", string.Empty).Replace("*", string.Empty).ToLower(); if (!string.IsNullOrWhiteSpace(query.SearchTerm)) { var userResponse = _searchProvider.FindUsers(query.SearchTerm, query.SearchType, query.PageSize, query.Page); searchResponse.UserSearchResult = userResponse; var accountResponse = _searchProvider.FindAccounts(query.SearchTerm, query.SearchType, query.PageSize, query.Page); searchResponse.AccountSearchResult = accountResponse; } } catch (ElasticSearchInvalidResponseException ex) { _log.Error(ex, $"Error while searching for {query.SearchTerm} search type {query.SearchType} on Page {query.Page}"); } return(await Task.FromResult(searchResponse)); }