/// <summary>
        /// Adds item to the buffer
        /// </summary>
        /// <param name="item">Item to be added</param>
        public void AddItem(T item)
        {
            if (item == null)
            {
                return;
            }
            UndoBufferNode <T> element = new UndoBufferNode <T>(item);

            if (this.count == 0)
            {
                start = current = element;
            }
            else
            {
                element.Prev = current;
                current.Next = element;
                current      = element;

                if (this.count == 1)
                {
                    start.Next = current;
                }
            }
            this.count++;

            if (this.bufferSize < this.count)
            {
                this.start      = this.start.Next;
                this.start.Prev = null;
                this.count--;
            }
            isAtBottom = false;
        }
 /// <summary>
 /// Resets(cleans) buffer
 /// </summary>
 public void ResetBuffer()
 {
     this.count      = 0;
     this.isAtBottom = true;
     this.start      = null;
     this.current    = null;
 }
        /// <summary>
        /// Redo
        /// </summary>
        /// <returns>Redo object</returns>
        public T Redo()
        {
            if (current == null)
            {
                return(null);
            }

            if (!isAtBottom)
            {
                if (current.Next != null)
                {
                    current = current.Next;
                    this.count++;
                }
            }
            else
            {
                isAtBottom = false;
            }
            return(current.Element);
        }
        /// <summary>
        /// Undo last element on buffer
        /// </summary>
        /// <returns>undo object</returns>
        public T Undo()
        {
            if (current == null)
            {
                return(null);
            }

            T undoObj = current.Element;

            if (current.Prev != null)
            {
                current = current.Prev;
                this.count--;
                this.isAtBottom = false;
            }
            else
            {
                this.isAtBottom = true;
            }

            return(undoObj);
        }