private async Task <DialogTurnResult> ShowRunningProcessStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var rpaService     = new RPAService();
            var processDetails = (ProcessDetails)stepContext.Options;
            var result         = stepContext.Result.ToString();
            var promptOption   = new PromptOption();

            try
            {
                promptOption = JsonConvert.DeserializeObject <PromptOption>(stepContext.Result.ToString());
            }
            catch (Exception) { }

            if (!string.IsNullOrEmpty(promptOption.Id))
            {
                if (promptOption.Id != "availableProcesses" && promptOption.Id != "menu")
                {
                    processDetails.Action = "pastMenu";
                    return(await stepContext.ReplaceDialogAsync(nameof(MainDialog), processDetails, cancellationToken));
                }
                result = promptOption.Value;
            }
            var _response = rpaService.GetUser(stepContext.Context.Activity.Conversation.Id);
            var user      = new List <User>();

            if (_response.IsSuccess)
            {
                user = JsonConvert.DeserializeObject <List <User> >(_response.Content);
            }
            if (result.ToLower() == "menu" || result.ToLower() == "m" /*"*****@*****.**"*/)
            {
                //save index
                user[0].u_last_index = "0";
                rpaService.UpdateUser(user[0], stepContext.Context.Activity.Conversation.Id);
                //_user.u_last_index = 0;
                //await _userAccessor.SetAsync(stepContext.Context, _user, cancellationToken);
                processDetails.Action = string.Empty;
                return(await stepContext.ReplaceDialogAsync(nameof(MainDialog), null, cancellationToken));
            }
            else if (result.ToLower() == "load_more")
            {
                processDetails.LoadMore = true;
                return(await stepContext.ReplaceDialogAsync(nameof(StatusDialog), processDetails, cancellationToken));
            }
            else
            {
                processDetails.ProcessSelected = rpaService.GetSelectedProcess(processDetails.Processes, result);
                //check if a process was selected, or something was written
                if (!string.IsNullOrEmpty(processDetails.ProcessSelected.Sys_id))
                {
                    //save index
                    user[0].u_last_index = "0";
                    rpaService.UpdateUser(user[0], stepContext.Context.Activity.Conversation.Id);
                    //_user.u_last_index = 0;
                    //await _userAccessor.SetAsync(stepContext.Context, _user, cancellationToken);
                    var apiRequest = new APIRequest
                    {
                        ProcessId = processDetails.ProcessSelected.Sys_id
                    };
                    if (!string.IsNullOrEmpty(processDetails.ProcessSelected.queuedId))
                    {
                        apiRequest.Queued = true;
                    }

                    var jobIds     = new List <string>();
                    var releaseIds = new List <string>();
                    //if there was a process started
                    if (processDetails.Jobs.Count > 0)
                    {
                        foreach (var job in processDetails.Jobs)
                        {
                            foreach (var item in job.Result.Body.Value)
                            {
                                jobIds.Add(item.Id);
                            }
                        }
                        apiRequest.Ids   = jobIds;
                        apiRequest.IsJob = true;
                    }
                    else
                    {
                        foreach (var release in processDetails.ProcessSelected.Releases)
                        {
                            releaseIds.Add(release.sys_id);
                        }
                        apiRequest.Ids   = releaseIds;
                        apiRequest.IsJob = false;
                    }

                    var response = rpaService.ProcessStatus(apiRequest);
                    var text     = string.Empty;
                    if (response.IsSuccess)
                    {
                        var processSatus = JsonConvert.DeserializeObject <List <ProcessStatus> >(response.Content);

                        text  = processSatus.Count > 1 ? "Here are the status for " : "Here is the latest status for ";
                        text += processDetails.ProcessSelected.Name + " process." + Environment.NewLine;
                        foreach (var item in processSatus)
                        {
                            var include = "Total Transactions Processed: " + item.TotalTransactions + Environment.NewLine;                            /* +
                                                                                                                                                       * "Run Time: " + item.Runtime + Environment.NewLine;*/
                            if (item.ProcessType == "procedural")
                            {
                                include = string.Empty;
                            }
                            var endTime   = item.End != null ? "End Time: " + item.End + Environment.NewLine : string.Empty;
                            var startTime = item.Start != null ? "Start Time: " + item.Start + Environment.NewLine : string.Empty;

                            text +=
                                "Status: " + item.State.label + Environment.NewLine +
                                startTime +
                                endTime +
                                include +
                                "Total Transactions Successful: " + Convert.ToInt32(item.TotalTransSuccessful) + Environment.NewLine +
                                "Total Exceptions: " + Convert.ToInt32(item.TotalExceptions) + Environment.NewLine +
                                "Bot Name: " + item.Robot + Environment.NewLine +
                                "Started By: " + item.startedBy;
                        }
                    }
                    else
                    {
                        text = response.Content;
                    }
                    var choices = rpaService.GetConfirmChoices();
                    return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions
                    {
                        Prompt = (Activity)ChoiceFactory.SuggestedAction(choices, text + Environment.NewLine + "Do you want to check the status of another process?")

                                 /*Prompt = MessageFactory.Text(text + Environment.NewLine + "Do you want to check the status of another process?"),
                                  * Choices = ChoiceFactory.ToChoices(new List<string> { "Yes", "No" })*/
                    }, cancellationToken));
                }
                else
                {
                    return(await stepContext.ReplaceDialogAsync(nameof(MainDialog), null, cancellationToken));
                }
            }
        }