public async Task RecordIntegerDataAsync(string tileName, int value, CancellationToken cancellationToken)
        {
            var integerData = new IntegerData(value, DateTimeOffsetProvider.Now);

            await TilesRepository.InsertData(tileName, TileType.Integer, integerData.ToBsonDocument(), cancellationToken);

            await _eventDispatcher.PublishAsync(new NewDataEvent(new TileId(tileName, TileType.Integer), new { integerData.Value, integerData.AddedOn }), cancellationToken);
        }
        public async Task RecordDataAsync(string tileName, int responseInMs, string appVersion, CancellationToken cancellationToken)
        {
            var heartBeatData = new HeartBeatData(responseInMs, appVersion, DateTimeOffsetProvider.Now);

            await TilesRepository.InsertData(tileName, TileType.HeartBeat, heartBeatData.ToBsonDocument(), cancellationToken);

            await _eventDispatcher.PublishAsync(new NewDataEvent(new TileId(tileName, TileType.HeartBeat), new { heartBeatData.ResponseTimeInMs, heartBeatData.AppVersion, heartBeatData.AddedOn }), cancellationToken);
        }
        public async Task RecordMetricDataAsync(string tileName, MetricType metricType, decimal currentValue, CancellationToken cancellationToken)
        {
            var metricData = new MetricData(currentValue, metricType, DateTimeOffsetProvider.Now);
            var tile = await TilesRepository.GetTileWithoutData(tileName, TileType.Metric, cancellationToken);

            var metricConfiguration = BsonSerializer.Deserialize<MetricConfiguration>(tile.Configuration);
            if (metricConfiguration.MetricType != metricType)
            {
                throw new NotSupportedOperationException($"Metric {tileName} is type of {metricConfiguration.MetricType} but type {metricType} has been passed.");
            }

            await TilesRepository.InsertData(tileName, TileType.Metric, metricData.ToBsonDocument(), cancellationToken);
            await _eventDispatcher.PublishAsync(new NewDataEvent(new TileId(tileName, TileType.Metric), new Type.MetricData(metricData.Value, metricData.AddedOn)), cancellationToken);
        }