Memento design pattern implementation