Refactoring TabletExternallyReparented.

Now that it is inside the agent, it can:
- log at the right time
- only trigger the afterAction if it changed something