IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
IWidgetDefault[] widgetDefault = persistenceManager.findByValue(IWidgetDefault.class, "widget", widget);
if (widgetDefault.length == 1) persistenceManager.delete(widgetDefault[0]);
// remove any widget instances for this widget
IWidgetInstance[] instances = persistenceManager.findByValue(IWidgetInstance.class, "widget", widget);
for(IWidgetInstance instance : instances){
// Delete all participants and shared data associated with any instances
//
// Note that we don't call this within WidgetInstanceFactory.destroy() as