hook up persistence for state changes