/// <summary>
        ///  Saves current SM statistics into storage slot.
        /// </summary>
        /// <param name="slotId">The slot id.</param>
        /// <returns>True is operation succeeded.</returns>
        public bool SaveSlot(int slotId)
        {
            bool result = false;
            lock (this.exclusiveLock)
            {
                StatisticsSnapshot ss;
                if (!this.savedStats.TryGetValue(slotId, out ss))
                {
                    if (this.LastHTTPLog != null)
                    {
                        ss = new StatisticsSnapshot(this.LastHTTPLog);
                        this.LastHTTPLog = null;
                    }
                    else
                    {
                        ss = new StatisticsSnapshot(this.totals);
                    }

                    this.savedStats.Add(slotId, ss);
                    result = true;
                }
            }

            return result;
        }
        /// <summary>
        ///  Saves current SM statistics into storage slot.
        /// </summary>
        /// <param name="slotId">The slot id.</param>
        /// <returns>True is operation succeeded.</returns>
        public bool SaveSlot(int slotId)
        {
            bool result = false;
            lock (this.exclusiveLock)
            {
                StatisticsSnapshot ss;
                if (!this.savedStats.TryGetValue(slotId, out ss))
                {
                    TimeSpan currentDuration = this.LastEndDate - this.LastStartDate;
                    if (this.LastHTTPLog != null)
                    {
                        ss = new StatisticsSnapshot(this.LastHTTPLog, currentDuration);
                        this.LastHTTPLog = null;
                    }
                    else
                    {
                        ss = new StatisticsSnapshot(this.totals, currentDuration);
                    }

                    this.savedStats.Add(slotId, ss);
                    this.totals.Reset();
                    this.statsByStream.Reset();
                    this.LastHTTPLog = null;
                    this.LastStartDate = DateTime.Now;
                    this.LastEndDate = this.LastStartDate;
                    result = true;
                }
            }

            return result;
        }