public void LaunchScriptWithParams(string name, PowerShellParam psParam) { var jobServices = new JobServices(_scriptRepository); //ToDo: Add Logic to Return True / False if successful var script = _scriptRepository.GetScriptById(psParam.Id); var newJob = new Job() { UserName = name, ScriptId = script.Id, Date = DateTime.Now, JobId = Int32.Parse(BackgroundJob.Enqueue(() => jobServices.Run(script.Name, psParam.PSparams))), Status = Status.Started }; _scriptRepository.InsertJob(newJob); _scriptRepository.Save(); }