private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; if (activity.Text == "help") { await ShowHelp(context); } else { ILifetimeScope scope = WebApiApplication.GetContainer(); try { IDialogCreator obj = scope.ResolveNamed <IDialogCreator>(activity.Text); context.Call(obj.CreateNewDialog(context), AfterDialog); } catch (Exception err) { await context.PostAsync(err.Message); await context.PostAsync("I don't understand"); context.Wait(MessageReceivedAsync); } } }