public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result) { var message = await result; var model = ProductModel.GetContextData(context); if (string.IsNullOrEmpty(model.API)) { context.Done("Sorry, Something went wrong!"); } SearchResult searchResult = await searchService.FilterByAPI(model.API); if (searchResult.value.Length != 0) { var apis = (from item in searchResult.value select item.Name) .ToList(); if (apis.Count() == 1) { model.Feature = apis.FirstOrDefault(); ProductModel.SetContextData(context, model); context.Done(apis.FirstOrDefault()); } else if (apis.Count() > 1) { string api = new CultureInfo("en").TextInfo.ToTitleCase(model.API.ToLower()); PromptDialog.Choice(context, OnFeatureOptionSelected, apis, $"Here are some of the key features available as part of the {model.API}", "Sorry, thats not a valid option", 3); } else { context.Fail(new ArgumentException($"No APIs were found with the name {message}")); } } else { context.Done("Oops! Something went wrong!"); } }