public async Task <HttpResponseMessage> GetBiographySearchSuggestion(string term) { try { var suggestionSet = await azureSearch.BiographySuggest(term, false); var suggestions = new List <string>(); foreach (var suggestion in suggestionSet.Results) { suggestions.Add(suggestion.Text); } var response = Request.CreateResponse(HttpStatusCode.OK, suggestions, Configuration.Formatters.JsonFormatter); return(response); } catch (Exception ex) { return(new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(ex.Message) }); } }