public async Task <bool> Execute(BatchRun batchRun) { Stopwatch stopWatch = Stopwatch.StartNew(); NextJobToRunResult result = _getNextJobToRun.Get(batchRun); BatchRunResult runResult = result.Result; if (runResult == null) { if (result.Complete) { _setRunStatus.Complete(batchRun); } if (result.Paused) { _setRunStatus.Paused(batchRun); } return(false); } if (runResult.BatchJob == null) { _setBatchJobExecutionStatus.Complete(runResult, BatchJobExecutionResult.Failure("No job associated to result")); } await _runBatchRunResult.Run(runResult, stopWatch); return(true); }