implement a memento pattern