private void AddLast(DoubleLinkedNode <T> node)
        {
            if (IsEmpty)
            {
                Head = node;
            }
            else
            {
                Tail.Next     = node;
                node.Previous = Tail;
            }
            Tail = node;

            Count++;
        }
        public void RemoveLast()
        {
            if (IsEmpty)
            {
                throw new InvalidOperationException();
            }

            if (Count == 1)
            {
                Head = null;
                Tail = null;
            }
            else
            {
                Tail.Previous.Next = null; // null the last node
                Tail = Tail.Previous;      // shift the Tail (now it is the former penultimate node)
            }

            Count--;
        }
        public void RemoveFirst()
        {
            if (IsEmpty)
            {
                throw new InvalidOperationException();
            }

            Head = Head.Next;

            Count--;

            if (IsEmpty)
            {
                Tail = null;
            }
            else
            {
                Head.Previous = null;
            }
        }