public async Task AddHistoricalAggregatedData(Guid dataSource, string sourceName, int aggregationSeconds, [FromBody] AggregatedDataRange dataRange)
        {
            _logger.LogDebug($"Received historical aggregated data for {sourceName} {aggregationSeconds} from {dataRange?.TimeRange?.Min.ToDateTime():s} to {dataRange?.TimeRange?.Max.ToDateTime():s} with {dataRange?.Data?.Count / 2} points");
            var(entity, attribute) = await _model.ResolveEntityAndAttribute(dataSource, sourceName);

            await _processor.ReceiveHistoricalData(entity, attribute, dataRange);
        }
        private async Task <IEnumerable <TimeRange> > GetMissingTimeRangesForSourceName(Guid dataSource, string sourceName)
        {
            var entityAttribute = await _modelProvider.ResolveEntityAndAttribute(dataSource, sourceName);

            var existingTimeRanges = await _persistence.GetAllTimeRanges(entityAttribute.Item1, entityAttribute.Item2);

            var desiredTimeRange = new TimeRange(_configuration.MinHistoryUtcSeconds.ToDateTime(), DateTime.UtcNow);

            var missing = _filterer.SubtractTimeRangesFromRange(desiredTimeRange, existingTimeRanges);

            /*if (sourceName == "KGP.KJF.KEL01.0023.PV")
             * {
             *  Console.WriteLine("Existing: " + JsonConvert.SerializeObject(existingTimeRanges));
             *  Console.WriteLine("Missing: " + JsonConvert.SerializeObject(missing));
             * }*/

            return(missing);
        }