private void ReportException(string source, Exception exception)
        {
            var message = $"{source}: {exception.Message}";

            while (exception?.InnerException != null)
            {
                message  += Environment.NewLine + exception.InnerException.Message;
                exception = exception.InnerException;
            }

            try
            {
                _jobStore.AddException(_tenantId, _jobId, new JobStatusErrorData
                {
                    ErrorMessage = message,
                    Timestamp    = DateTime.UtcNow.Ticks,
                    StackTrace   = exception.StackTrace
                })
                .GetAwaiter()
                .GetResult();
            }
            catch (Exception e)
            {
                Log.Error($"Job runner {_jobId} - Could not add exception due to exception", e);
            }
        }
        private void ReportException(string source, Exception exception)
        {
            var message = $"{source}: {exception.Message}";

            if (exception.InnerException != null)
            {
                message += Environment.NewLine + exception.InnerException.Message;
            }

            _jobStore.AddException(_tenantId, _jobId, new JobStatusErrorData
            {
                ErrorMessage = message,
                Timestamp    = DateTime.UtcNow.Ticks
            })
            .GetAwaiter()
            .GetResult();
        }