Add guards in execute to make registration/unregistration idempotent.