Add cleanup API for rule triggers/conditions/actions (to fix duplicates)
I've found on various sites that the triggers/conditions/actions are duplicated in the database. I'm not sure what causes this.
This adds an API to cleanup and remove duplicates.