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.
On 15/08/2014 10:57 AM, Jesse Reynolds wrote:

> So timing will be interesting, of course. If an entity is renamed before
> the check execution system is updated then when a check result comes in
> from the old named entity the old entity name will be created and a uuid
> generated for its ID, and it'll have all new state. When the check
> execution system config catches up, all will be good again, except for
> the unnecessary keys created afresh for the old name, which won't be
> able to be cleaned up. I can't think of any way around this.

Yup, that's pretty much the size of it.

> And if it's the other way around, check execution system is updated
> before the entity is renamed in flapjack, then the check data will we
> lost? Or will the check data be re-parented when the entity is renamed?
> I will keep reading the source...

We create new entities for them if they're unknown... which would block 
a rename. A deficiency in the code for this, but it's possibly the best 
we can currently do.

Simpler to just switch to v2 or a similar data scheme, where a rename 
doesn't affect core linkages. :)