public async Task <IActionResult> PostNotifications(string applicationName, [FromBody] WebNotificationRequestItemsContainer webNotificationRequestsContainer, [FromServices] INotificationsChannel notificationsChannel) { IActionResult result = null; using (this.logger.BeginScope($"RootActivityId: {this.RootActivityId}")) { this.logger.LogInformation($"Started {nameof(this.PostNotifications)} method of {nameof(NotificationsController)}."); if (string.IsNullOrWhiteSpace(applicationName)) { throw new ArgumentException("Application name is mandatory.", nameof(applicationName)); } if (webNotificationRequestsContainer is null) { throw new ArgumentNullException(nameof(webNotificationRequestsContainer)); } if (notificationsChannel == null) { throw new ArgumentNullException(nameof(notificationsChannel)); } IEnumerable <WebNotification> notifications = await this.notificationsManager.ProcessNotificationsAsync(applicationName, webNotificationRequestsContainer.Notifications).ConfigureAwait(false); foreach (var notification in notifications.ToList()) { _ = notificationsChannel.AddNotificationAsync(notification); } result = this.Accepted(); this.logger.LogInformation($"Finished {nameof(this.PostNotifications)} method of {nameof(NotificationsController)}."); } return(result); }