// not just the one being deleted.
//
// Note also that we have to use the instance as the hook for removing participants as there is no
// specific query for getting participants for a widget.
//
IParticipant[] participants = new SharedContext(instance).getParticipants();
persistenceManager.delete(participants);
ISharedData[] sharedData = new SharedContext(instance).getSharedData();
persistenceManager.delete(sharedData);
// remove any preferences
IPreference[] preferences = instance.getPreferences().toArray(new IPreference[instance.getPreferences().size()]);// persistenceManager.findByValue(IPreference.class, "widgetInstance", instance);
persistenceManager.delete(preferences);