private async Task <DialogTurnResult> ProcessStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { Dictionary <string, object> args = (Dictionary <string, object>)stepContext.Options; TokenResponse tokenResponse = (TokenResponse)args["TokenResponse"]; var userProfile = new UserProfile(); //Contains the inputed variables var rawValues = (JObject)stepContext.Context.Activity.Value; foreach (var val in rawValues) { if (val.Key != "Domain") { userProfile.GetType().GetProperty(val.Key.ToString()).SetValue(userProfile, val.Value.ToString()); } else { userProfile.Domain = val.Value.ToString(); } } userProfile.DomainName = userProfile.GivenName.Replace(" ", "") + userProfile.SurName.Replace(" ", ""); userProfile.UserPrincipalName = userProfile.DomainName + userProfile.Domain; await OAuthHelpers.CreateUserAsync(stepContext.Context, tokenResponse, userProfile); return(await stepContext.EndDialogAsync(null, cancellationToken)); }