private async Task RunbookParametersFormComplete(IDialogContext context, RunbookParameterFormState runbookParameterFormState) { var runbookFormState = context.GetRunbookFormState(); if (runbookParameterFormState != null) { runbookFormState.RunbookParameters.Add(runbookParameterFormState); context.StoreRunbookFormState(runbookFormState); } var nextRunbookParameter = runbookFormState.SelectedRunbook.RunbookParameters.OrderBy(param => param.Position).FirstOrDefault( availableParam => !runbookFormState.RunbookParameters.Any(stateParam => availableParam.ParameterName == stateParam.ParameterName)); if (nextRunbookParameter == null) { context.CleanupRunbookFormState(); await this.RunbookFormComplete(context, runbookFormState); return; } var formState = new RunbookParameterFormState(nextRunbookParameter.IsMandatory, nextRunbookParameter.Position == 0, runbookFormState.SelectedRunbook.RunbookName) { ParameterName = nextRunbookParameter.ParameterName }; var form = new FormDialog <RunbookParameterFormState>( formState, AutomationForms.BuildRunbookParametersForm, FormOptions.PromptInStart); context.Call(form, this.RunbookParameterFormComplete); }