Move state machine knowledge out of the record layer