public int ReplaceCandles(IEnumerable<ICandle> candlesToReplace)
        {
            var replacedCount = 0;

            foreach (var candle in candlesToReplace)
            {
                var tick = GetIntervalTick(candle.Timestamp, candle.TimeInterval);

                if (Candles.RemoveAll(c => c.Tick == tick) <= 0)
                    continue; // Can't replace if there was no candle with the requested tick.

                Candles.Add(candle.ToItem(tick));
                replacedCount++;
            }

            // Sorting candles for storing in DB in proper order.
            Candles.Sort((a, b) => a.Tick.CompareTo(b.Tick));

            return replacedCount;
        }