An (unfortunately) epic refactor to use the DSL to define the state sub-resources on each base resource instead of having specialised code for it.