/// <summary>
        /// Adds all of the items in the stream to this tree. Skips any dulpicate entries.
        /// </summary>
        /// <param name="stream">the stream to add.</param>
        public void TryAddRange(TreeStream <TKey, TValue> stream)
        {
            //TKey key = new TKey();
            //TValue value = new TValue();
            //while (stream.Read(key, value))
            //{
            //    TryAdd(key, value);
            //}
            //return;

            InsertStreamHelper <TKey, TValue> helper = new InsertStreamHelper <TKey, TValue>(stream);

            LeafStorage.TryInsertSequentialStream(helper);
            while (helper.IsValid)
            {
                if (helper.IsKVP1)
                {
                    LeafStorage.TryInsert(helper.Key1, helper.Value1);
                }
                else
                {
                    LeafStorage.TryInsert(helper.Key2, helper.Value2);
                }
                helper.NextDoNotCheckSequential();
            }
            if (IsDirty && AutoFlush)
            {
                m_header.SaveHeader(Stream);
            }
        }