private void DoConversion() { _slice = _context.Slices .Where(x => x.Id == _configurationService.SliceId).Include(i => i.Job.Slices) .SingleOrDefault(); _logger.LogInformation($"Found slice with JobId:{_slice.JobId}, SliceId:{_slice.Id} with status of {_slice.Status} to convert"); UpdateConfigurationServiceProperties(_slice); if (_slice.Status == SliceStatus.Starting) { _slice.Status = SliceStatus.Running; _slice.SliceStarted = DateTime.Now; _messageQueueService.PublishMessage(_slice.ToMessage()); _logger.LogInformation($"SliceId {_slice.Id} conversion is running."); _configurationService.ServiceInfoStatus = ServiceInfoStatus.Waiting; Thread.Sleep(_configurationService.SleepDuration); _configurationService.ServiceInfoStatus = ServiceInfoStatus.Running; //Complete Slice Conversion _slice.Status = SliceStatus.Completed; _slice.SliceCompleted = DateTime.Now; _messageQueueService.PublishMessage(_slice.ToMessage()); _configurationService.ServiceInfoStatus = ServiceInfoStatus.CompletedSuccessfully; _logger.LogInformation($"SliceId {_slice.Id} conversion has completed."); _configurationService.ServiceInfoStatus = ServiceInfoStatus.CompletedSuccessfully; } else { _logger.LogError($"SliceId {_slice.Id} is either currently running or already completed."); } }