private async Task RebuildPointsOfInterest()
        {
            _logger.LogInformation("Starting rebuilding POIs database.");
            var osmSource       = _pointsOfInterestAdapterFactory.GetBySource(Sources.OSM);
            var osmFeaturesTask = osmSource.GetPointsForIndexing();
            var sources         = _pointsOfInterestAdapterFactory.GetAll().Where(s => s.Source != Sources.OSM).Select(s => s.Source);
            var otherTasks      = sources.Select(s => _elasticSearchGateway.GetExternalPoisBySource(s));
            await Task.WhenAll(new Task[] { osmFeaturesTask }.Concat(otherTasks));

            var features = _featuresMergeExecutor.Merge(osmFeaturesTask.Result.Concat(otherTasks.SelectMany(t => t.Result)).ToList());

            foreach (var feature in features)
            {
                var geoLocation = feature.Attributes[FeatureAttributes.POI_GEOLOCATION] as AttributesTable;
                feature.Attributes.AddOrUpdate(FeatureAttributes.POI_ALT, await _elevationDataStorage.GetElevation(
                                                   new Coordinate((double)geoLocation[FeatureAttributes.LON], (double)geoLocation[FeatureAttributes.LAT]))
                                               );
                var northEast = _mathTransform.Transform((double)geoLocation[FeatureAttributes.LON], (double)geoLocation[FeatureAttributes.LAT]);
                feature.Attributes.AddOrUpdate(FeatureAttributes.POI_ITM_EAST, (int)northEast.x);
                feature.Attributes.AddOrUpdate(FeatureAttributes.POI_ITM_NORTH, (int)northEast.y);
            }
            await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features);

            _logger.LogInformation("Finished rebuilding POIs database.");
        }
        private async Task RebuildPointsOfInterest()
        {
            _logger.LogInformation("Starting rebuilding POIs database.");
            var fetchTasks = _pointsOfInterestAdapterFactory.GetAll().Select(a => a.GetPointsForIndexing()).ToArray();
            var features   = (await Task.WhenAll(fetchTasks)).SelectMany(v => v).ToList();

            features = _featuresMergeExecutor.Merge(features);
            await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features);

            _logger.LogInformation("Finished rebuilding POIs database.");
        }
        private async Task RebuildPointsOfInterest()
        {
            _logger.LogInformation("Starting rebuilding POIs database.");
            var osmSource       = _pointsOfInterestAdapterFactory.GetBySource(Sources.OSM);
            var osmFeaturesTask = osmSource.GetPointsForIndexing();
            var sources         = _pointsOfInterestAdapterFactory.GetAll().Where(s => s.Source != Sources.OSM).Select(s => s.Source);
            var otherTasks      = sources.Select(s => _elasticSearchGateway.GetExternalPoisBySource(s)).ToArray();
            await Task.WhenAll(new Task[] { osmFeaturesTask }.Concat(otherTasks));

            var features = _featuresMergeExecutor.Merge(osmFeaturesTask.Result.Concat(otherTasks.SelectMany(t => t.Result)).ToList());
            await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features);

            _logger.LogInformation("Finished rebuilding POIs database.");
        }
        /// <inheritdoc />
        public async Task Rebuild(UpdateRequest request, Stream stream)
        {
            if (request.Highways)
            {
                _logger.LogInformation("Starting rebuilding highways database.");
                var osmHighways = await _osmRepository.GetAllHighways(stream);

                var geoJsonHighways = _osmGeoJsonPreprocessorExecutor.Preprocess(osmHighways);
                await _elasticSearchGateway.UpdateHighwaysZeroDownTime(geoJsonHighways);

                _logger.LogInformation("Finished rebuilding highways database.");
            }
            if (request.PointsOfInterest)
            {
                _logger.LogInformation("Starting rebuilding POIs database.");
                var fetchTask = _adapters.Select(a => a.GetPointsForIndexing(stream)).ToArray();
                var features  = await Task.WhenAll(fetchTask);

                await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features.SelectMany(v => v).ToList());

                _logger.LogInformation("Finished rebuilding POIs database.");
            }
        }