private bool SdnListBeenUpdated(out OfacFeedSubscription ofacFeedSubscription)
        {
            ofacFeedSubscription = _sdnListMonitoringService.GetLatestSdnSubscription();

            if (ofacFeedSubscription == null)
            {
                _logger.Log("ofacFeedSubscription extraction failed", LogLevel.Fatal);
                return(false);
            }

            return(_sdnListMonitoringService.SdnListBeenUpdated(ofacFeedSubscription));
        }
        public bool SdnListBeenUpdated(OfacFeedSubscription ofacFeedSubscription)
        {
            var lastPublicationDate = ofacFeedSubscription.Channel.PubDate.ParsePublicationDate();

            if (!lastPublicationDate.HasValue)
            {
                _logger.Log("lastPublicationDate parsing failed", LogLevel.Error);
                return(false);
            }

            return(_sdnRepository.GetLastUpdateDateTime() < lastPublicationDate);
        }
        public void ProcessNewestSdnItems(OfacFeedSubscription ofacFeedSubscription)
        {
            for (var i = ofacFeedSubscription.Channel.Items.Count - 1; i >= 0; i--)
            {
                var item = ofacFeedSubscription.Channel.Items[i];

                var publicationDate = item.PubDate.ParsePublicationDate();
                if (publicationDate == null || !(publicationDate > _sdnRepository.GetLastUpdateDateTime()))
                {
                    continue;
                }

                var updatedSource = _contentDownloader.DownloadContent(item.Link);

                var addedSdnItems = _contentParser.TryExtractSdnItems(updatedSource, SdnChangeType.Add);
                ExtractAndStoreUpdatedSdnItems(addedSdnItems, (DateTime)publicationDate, SdnChangeType.Add);

                var updatedSdnItems = _contentParser.TryExtractSdnItems(updatedSource, SdnChangeType.Update);
                ExtractAndStoreUpdatedSdnItems(updatedSdnItems, (DateTime)publicationDate, SdnChangeType.Update);

                var removedSdnItems = _contentParser.TryExtractSdnItems(updatedSource, SdnChangeType.Remove);
                ExtractAndStoreUpdatedSdnItems(removedSdnItems, (DateTime)publicationDate, SdnChangeType.Remove);
            }
        }
 private void ProcessNewestSdnItems(OfacFeedSubscription ofacFeedSubscription)
 => _sdnItemsProcessingService.ProcessNewestSdnItems(ofacFeedSubscription);