Refactor RegistrationBase._update_state() to be more testable.

Move the create/delete node code into separate methods for easier
testing and write all those tests.