Rename state with entity, and reparent orphaned entity data

Fixes #599.

Ready for discussion and review. It's pretty complex -- parallel reference to http://flapjack.io/docs/1.0/development/DATA_STRUCTURES/ is assumed, and the merge case especially gets fairly complicated depending on the possible orders of events.
Data merging might still be necessary even in v2, due to the time mismatches between renames and data described above, we'd probably want to have some sort of "previously known as" list of names for each entity as well. Not sure what would happen with name reuse in such a scenario.