/// <summary>
        /// Restores the subject to the next state on the redo stack, and stores the state before redoing to undo stack.
        /// Method <see cref="CanRedo()"/> can be called before calling this method.
        /// </summary>
        /// <seealso cref="Undo()"/>
        public void Redo()
        {
            if (tempMemento != null)
            {
                throw new InvalidOperationException("The complex memento wasn't commited.");
            }

            inUndoRedo = true;
            IMemento <T> top = redoStack.Pop();

            undoStack.Push(top.Restore(ref subject));
            inUndoRedo = false;
        }