Apply method moved from state to state handler* class

And state descriptors renamed to state handlers. They are optional and
required to be implemented only when some things should be done on state
applying and un-applying.