private int[] PushProducts(Article[] products, bool isStage, string userName, int userId, string method, bool localize, bool autopublish, string[] forcedСhannels) { var notifications = GetNotifications(products, isStage, forcedСhannels, localize, autopublish); if (notifications == null) { return(null); } if (notifications.Any()) { var customerCode = _identityProvider.Identity.CustomerCode; if (!String.IsNullOrEmpty(_integrationProperties.RestNotificationUrl)) { var client = _httpClientFactory.CreateClient(); var json = JsonConvert.SerializeObject(notifications); var content = new StringContent(json, Encoding.UTF8, "application/json"); var url = GetRestUrl(isStage, userName, userId, method, customerCode); var result = client.PutAsync(url, content).Result; if (!result.IsSuccessStatusCode) { throw new ApplicationException("Notification sending failed with status code " + result.StatusCode); } } else if (!String.IsNullOrEmpty(_integrationProperties.WcfNotificationUrl)) { var myBinding = new BasicHttpBinding(); var myEndpoint = new EndpointAddress(_integrationProperties.WcfNotificationUrl); var service = new NotificationServiceClient(myBinding, myEndpoint); service.PushNotifications(notifications, isStage, userId, userName, method, customerCode); } } return(notifications.Select(n => n.ProductId).ToArray()); }