Extension extension = (Extension) notification.getNotifier();
if(extension.getExtendedObject() == null && extension.getExtensionObject() == null &&
extension.eContainer() != null){
ExtensionMap extensionSet = (ExtensionMap)extension.eContainer();
if(extensionSet != null && extensionSet.getExtensions().contains(extension))
extensionSet.getExtensions().remove(extension);
}
// If the extendedObject is not null set it to null now
if (extension.getExtendedObject() != null)
extension.setExtendedObject(null);