// ReSharper disable once UnusedMember.Global
        public async Task PublishReleaseFiles(
            [QueueTrigger(PublishReleaseFilesQueue)]
            PublishReleaseFilesMessage message,
            ExecutionContext executionContext,
            ILogger logger)
        {
            logger.LogInformation("{0} triggered: {1}",
                                  executionContext.FunctionName,
                                  message);

            var immediate = await IsImmediate(message);

            var published = new List <(Guid ReleaseId, Guid ReleaseStatusId)>();

            foreach (var(releaseId, releaseStatusId) in message.Releases)
            {
                await UpdateStage(releaseId, releaseStatusId, Started);

                try
                {
                    await _publishingService.PublishMethodologyFilesIfApplicableForRelease(releaseId);

                    await _publishingService.PublishReleaseFiles(releaseId);

                    published.Add((releaseId, releaseStatusId));
                }
                catch (Exception e)
                {
                    logger.LogError(e, "Exception occured while executing {0}",
                                    executionContext.FunctionName);
                    logger.LogError("{StackTrace}", e.StackTrace);

                    await UpdateStage(releaseId, releaseStatusId, Failed,
                                      new ReleasePublishingStatusLogMessage($"Exception in files stage: {e.Message}"));
                }
            }

            try
            {
                if (immediate)
                {
                    await _queueService.QueuePublishReleaseDataMessagesAsync(published);
                }
                else
                {
                    await _queueService.QueueGenerateReleaseContentMessageAsync(published);
                }

                foreach (var(releaseId, releaseStatusId) in published)
                {
                    await UpdateStage(releaseId, releaseStatusId, Complete);
                }
            }
            catch (Exception e)
            {
                logger.LogError(e, "Exception occured while executing {0}",
                                executionContext.FunctionName);
                logger.LogError("{0}", e.StackTrace);
            }

            logger.LogInformation("{0} completed",
                                  executionContext.FunctionName);
        }