InternalEObject oldContainer = eInternalContainer();
if (oldContainer != null)
{
if (eContainmentFeature().isResolveProxies())
{
Resource.Internal oldContainerResource = oldContainer.eInternalResource();
if (oldContainerResource != null)
{
// If we're not setting a new resource, attach it to the old container's resource.
if (resource == null)
{