The Memento Design Pattern is used for memorising the state of objects for functions like undo or rollback.
In order to archive this you build a so called memento-objects that has a universal for storing and retrieving a state. Other objects can then implement functions for storing their state into a memento or restoring state from a memento. Based on the use case you then only need to manage mementos and no further domain knowledge is needed.