public async Task <IActionResult> Submit(string signalRconnectionId, string runbookDisplayName, string runbookName, string runbookHybridWorkerGroup, Dictionary <string, string> inputs)
        {
            Dictionary <string, string> inputsSanitized = SanitizeInput(HttpContext, inputs);

            _messageSender.ConnectionId = signalRconnectionId;
            await _messageSender.SendMessage(_configuration["Text:OutputMessageJobStarted"]);

            //Initialize viewmodel
            AzureRunbookFormViewModel azureRunbookFormViewModel = new AzureRunbookFormViewModel
            {
                ResourceGroup     = _resourceGroup,
                AutomationAccount = _automationAccount,
                RunbookName       = runbookName,
                HybridWorkerGroup = runbookHybridWorkerGroup,
                Runbook           = new RunbookSimple {
                    Name = runbookName, DisplayName = runbookDisplayName
                },
                ResultsModel = new ResultsModel()
                {
                    JobInputs = inputsSanitized
                }
            };

            //AUDIT LOG - START
            if (Configuration.GetValue <bool>("EnableAuditLogging") == true)
            {
                AuditLog logEntry = new AuditLog
                {
                    RequestName  = runbookName,
                    RequestUser  = HttpContext.User.Identity.Name,
                    RequestInput = JsonConvert.SerializeObject(inputsSanitized, Formatting.None)
                };
                _automationPortalDbContext.Add(logEntry);

                await _automationPortalDbContext.SaveChangesAsync();
            }
            //AUDIT LOG - END

            if (CurrentPageType == PageType.Default)
            {
                //Check session cache for existing runbooks if this is null then retrieve runbooks from azure
                azureRunbookFormViewModel.Runbooks = string.IsNullOrEmpty(HttpContext.Session.GetString("Runbooks")) ?
                                                     await _customAzureOperations.GetRunbooks(_resourceGroup, _automationAccount).ConfigureAwait(false)
                    : JsonConvert.DeserializeObject <IList <RunbookSimple> >(HttpContext.Session.GetString("Runbooks"));

                return(View($"Result{CurrentPageType}", azureRunbookFormViewModel));
            }

            return(View($"Result{CurrentPageType}", azureRunbookFormViewModel));
        }
        public async Task <IActionResult> Index(PageType?pageType, [FromRoute] string runbookName, string resourceGroup, string automationAccount)
        {
            //Set type of page to return. If nothing is passed set Full Width as default
            pageType        = pageType.HasValue ? pageType : PageType.FullWidth;
            currentPageType = pageType.GetValueOrDefault();

            //save runbook variables
            StaticRepo.RunbookName       = runbookName;
            StaticRepo.AutomationAccount = automationAccount;
            StaticRepo.ResourceGroup     = resourceGroup;
            var azureRunbookFormViewModel = new AzureRunbookFormViewModel
            {
                ResourceGroup     = resourceGroup,
                AutomationAccount = automationAccount,
                RunbookName       = runbookName
            };

            return(View($"Index{pageType.Value}", azureRunbookFormViewModel));
        }