merge instance script

This adds a script for merging two instances. All references to the source instance are changed to point to the target instance. However there are two exceptions:

-  Instance Badges
-  refs (used e.g. in events)

There is no real reason for these exceptions other than it is complicated.