Add snapshot support to state machines.