/// <summary>
        /// Observes first <see cref="count"/> records from reversed list
        /// where version is less or equal to <see cref="max"/>.
        /// </summary>
        /// <param name="max">Max version observed.</param>
        /// <param name="count">Max count of observed records.</param>
        /// <param name="observer">Observer action.</param>
        public void ObserveTill(long max, int count, Action <TapeRecord> observer)
        {
            // It's assumed that FileTapeStream uses Versions as index
            // and Version will increase by one without gaps.

            // Read backward
            var start      = Math.Min(max, _cache.GetCurrentVersion());
            var end        = Math.Max(start - count, 0);
            var totalCount = (int)(start - end);

            var index = 0;

            while (true)
            {
                var readCount = Math.Min(BatchSize, totalCount - index);
                if (readCount == 0)
                {
                    break;
                }

                var records = _cache.ReadRecords(start - readCount - index, readCount).ToArray();
                if (records.Length == 0)
                {
                    break;
                }

                foreach (var record in records.Reverse())
                {
                    observer(record);
                }

                index += records.Length;
            }
        }