private async Task ProcessCandlesUpdatedEventAsync(CandlesUpdatedEvent candlesUpdate)
        {
            try
            {
                var validationErrors = ValidateQuote(candlesUpdate);
                if (validationErrors.Any())
                {
                    var message = string.Join("\r\n", validationErrors);
                    await _log.WriteWarningAsync(nameof(CandlesSubscriber), nameof(CandlesUpdatedEvent), candlesUpdate.ToJson(), message);

                    return;
                }

                var candles = candlesUpdate.Candles
                    .Where(candleUpdate =>
                        Constants.StoredIntervals.Contains(candleUpdate.TimeInterval) &&
                        _candlesChecker.CanHandleAssetPair(candleUpdate.AssetPairId))
                    .Select(candleUpdate => Candle.Create(
                        priceType: candleUpdate.PriceType,
                        assetPair: candleUpdate.AssetPairId,
                        timeInterval: candleUpdate.TimeInterval,
                        timestamp: candleUpdate.CandleTimestamp,
                        open: candleUpdate.Open,
                        close: candleUpdate.Close,
                        low: candleUpdate.Low,
                        high: candleUpdate.High,
                        tradingVolume: candleUpdate.TradingVolume,
                        tradingOppositeVolume: candleUpdate.TradingOppositeVolume,
                        lastTradePrice: candleUpdate.LastTradePrice,
                        lastUpdateTimestamp: candleUpdate.ChangeTimestamp))
                    .ToArray();

                await _candlesManager.ProcessCandlesAsync(candles);
            }
            catch (Exception)
            {
                await _log.WriteWarningAsync(nameof(CandlesSubscriber), nameof(ProcessCandlesUpdatedEventAsync), candlesUpdate.ToJson(), "Failed to process candle");
                throw;
            }
        }
        private async Task ProcessCandlesUpdatedEventAsync(CandlesUpdatedEvent candlesUpdate)
        {
            try
            {
                if (_cacheInitalizationService.InitializationState != CacheInitializationState.Idle)
                {
                    await Task.Delay(5000);

                    throw new InvalidOperationException("Initialization in progress");
                }

                var validationErrors = ValidateQuote(candlesUpdate);

                if (validationErrors.Any())
                {
                    var message = string.Join("\r\n", validationErrors);
                    _log.Warning(nameof(ProcessCandlesUpdatedEventAsync), message, context: candlesUpdate.ToJson());

                    return;
                }

                var candles = candlesUpdate.Candles
                              .Where(candleUpdate =>
                                     _candlesChecker.CanHandleAssetPair(candleUpdate.AssetPairId))
                              .Select(candleUpdate => Candle.Create(
                                          priceType: candleUpdate.PriceType,
                                          assetPair: candleUpdate.AssetPairId,
                                          timeInterval: candleUpdate.TimeInterval,
                                          timestamp: candleUpdate.CandleTimestamp,
                                          open: candleUpdate.Open,
                                          close: candleUpdate.Close,
                                          low: candleUpdate.Low,
                                          high: candleUpdate.High,
                                          tradingVolume: candleUpdate.TradingVolume,
                                          tradingOppositeVolume: candleUpdate.TradingOppositeVolume,
                                          lastTradePrice: candleUpdate.LastTradePrice,
                                          lastUpdateTimestamp: candleUpdate.ChangeTimestamp))
                              .ToArray();

                await _candlesManager.ProcessCandlesAsync(candles);
            }
            catch (Exception)
            {
                _log.Warning(nameof(ProcessCandlesUpdatedEventAsync), "Failed to process candle", context: candlesUpdate.ToJson());
                throw;
            }
        }