internal void insert(dynamic key, BPlusTree b)
        {
            if (!leaf)
            {
                bool           getIn = true;
                int            i     = 0;
                List <dynamic> l     = new List <dynamic>(keys);
                foreach (dynamic d in l)
                {
                    if (key < d)
                    {
                        getIn = false;
                        childs[i].insert(key, b);
                        break;
                    }
                    i++;
                }
                if (getIn)
                {
                    childs[i].insert(key, b);
                }
            }
            else
            {
                keys.Add(key);
                if (keys.Count == min_degree)
                {
                    List <dynamic> l = new List <dynamic>(keys);
                    if (root)
                    {
                        dynamic middle  = l[keys.Count / 2];
                        node    newRoot = new node(true, false);
                        newRoot.keys.Add(middle);
                        node left  = new node(false, true);
                        node right = new node(false, true);
                        for (int i = 0; i < keys.Count / 2; i++)
                        {
                            left.keys.Add(l[i]);
                        }
                        for (int i = keys.Count / 2; i < keys.Count; i++)
                        {
                            right.keys.Add(l[i]);
                        }
                        left.parent  = newRoot;
                        right.parent = newRoot;
                        newRoot.childs.Add(left);
                        newRoot.childs.Add(right);
                        b.setRoot(newRoot);
                    }
                    else
                    {
                        dynamic             middle = l[keys.Count / 2];
                        SortedSet <dynamic> left   = new SortedSet <dynamic>();
                        node right = new node(false, true);
                        for (int i = keys.Count / 2; i < keys.Count; i++)
                        {
                            right.keys.Add(l[i]);
                        }
                        right.parent = parent;
                        for (int i = 0; i < keys.Count / 2; i++)
                        {
                            left.Add(l[i]);
                        }
                        this.keys = left;

                        parent.parentInsert(middle, right, b);
                    }
                }
            }
        }
        private void parentInsert(dynamic key, node rright, BPlusTree b)
        {
            keys.Add(key);
            List <dynamic> l = new List <dynamic>(keys);

            childs.Insert(l.IndexOf(key) + 1, rright);
            if (keys.Count == min_degree)
            {
                if (root)
                {
                    dynamic middle  = l[keys.Count / 2];
                    node    newRoot = new node(true, false);
                    newRoot.keys.Add(middle);
                    node left  = new node(false, false);
                    node right = new node(false, false);
                    for (int i = 0; i < keys.Count / 2; i++)
                    {
                        left.keys.Add(l[i]);
                    }
                    for (int i = keys.Count / 2 + 1; i < keys.Count; i++)
                    {
                        right.keys.Add(l[i]);
                    }
                    for (int i = 0; i < childs.Count / 2; i++)
                    {
                        childs[i].parent = left;
                        left.childs.Add(childs[i]);
                    }
                    for (int i = childs.Count / 2; i < childs.Count; i++)
                    {
                        childs[i].parent = right;
                        right.childs.Add(childs[i]);
                    }
                    left.parent  = newRoot;
                    right.parent = newRoot;
                    newRoot.childs.Add(left);
                    newRoot.childs.Add(right);
                    b.setRoot(newRoot);
                }
                else
                {
                    dynamic             middle = l[keys.Count / 2];
                    SortedSet <dynamic> left   = new SortedSet <dynamic>();
                    List <node>         dick   = new List <node>();
                    node right = new node(false, false);
                    for (int i = keys.Count / 2 + 1; i < keys.Count; i++)
                    {
                        right.keys.Add(l[i]);
                    }
                    for (int i = 0; i < keys.Count / 2; i++)
                    {
                        left.Add(l[i]);
                    }
                    this.keys = left;
                    for (int i = childs.Count / 2; i < childs.Count; i++)
                    {
                        childs[i].parent = right;
                        right.childs.Add(childs[i]);
                    }
                    for (int i = 0; i < childs.Count / 2; i++)
                    {
                        childs[i].parent = this;
                        dick.Add(childs[i]);
                    }
                    this.childs  = dick;
                    right.parent = parent;
                    parent.parentInsert(middle, right, b);
                }
            }
        }