=memento and command pattern.