private async Task CreateCrawlerTask(string organizationId, string hostname, int port, HashSet <IPAddressRange> ranges, CancellationToken token)
        {
            logger.Info(string.Format(CultureInfo.InvariantCulture, "Starting crawler for organizationId: {0}, hostname: {1}, port: {2}", organizationId, hostname, port));

            var outFile  = Path.Combine(this.outputPath, string.Format(CultureInfo.InvariantCulture, "{0}.txt", organizationId));
            var consumer = new RWhoisConsumer(outFile.ToString());

            try
            {
                var crawler = new RWhoisCrawler(hostname, port, attemptCrawlOrganizations: this.attemptCrawlOrganizations);
                await crawler.ConnectAsync();

                crawler.Subscribe(consumer);
                await crawler.CrawlRangesAsync(ranges, token);

                logger.Info(string.Format(CultureInfo.InvariantCulture, "Done with crawler for organizationId: {0}, hostname: {1}, port: {2}", organizationId, hostname, port));
                consumer.OnCompleted();
            }
            catch (OperationCanceledException ex)
            {
                logger.Warn(string.Format(CultureInfo.InvariantCulture, "Crawling was cancelled, exception raised: {0}", ex.Message));
                consumer.OnError(ex);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                consumer.OnError(ex);
            }
        }
        private async Task CreateCrawlerTask(string organizationId, string hostname, int port, HashSet <IPAddressRange> ranges)
        {
            try
            {
                logger.Info(string.Format(CultureInfo.InvariantCulture, "Starting crawler for organizationId: {0}, hostname: {1}, port: {2}", organizationId, hostname, port));

                var crawler = new RWhoisCrawler(hostname, port, attemptCrawlOrganizations: this.attemptCrawlOrganizations);
                await crawler.ConnectAsync();

                var outFile = Path.Combine(this.outputPath, string.Format(CultureInfo.InvariantCulture, "{0}.txt", organizationId));

                var consumer = new RWhoisConsumer(outFile.ToString());

                crawler.Subscribe(consumer);
                await crawler.CrawlRangesAsync(ranges);

                logger.Info(string.Format(CultureInfo.InvariantCulture, "Done with crawler for organizationId: {0}, hostname: {1}, port: {2}", organizationId, hostname, port));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }