Re-applying djazayeri's changes that add in explicit transaction management to insert and remove idsets in new transactions, to avoid database locking issues with long-running transactions.  Also add in code to the module activator that ensures the idset table is cleared upon module shutdown/startup