private void Initialize()
 {
     changeVariantController = Frame.GetController <ChangeVariantController>();
     if (changeVariantController != null)
     {
         changeVariantController.ChangeVariantAction.Executed += ChangeVariantAction_ExecutedCompleted;
     }
     modelViews            = (IModelList <IModelView>)View.Model.Application.Views;
     variantsProvider      = Application.Modules.FindModule <ViewVariantsModule>().VariantsProvider;
     rootModelViewVariants = (IModelList <IModelVariant>)((IModelViewVariants)modelViews[GetRootViewId()]).Variants;
 }
 protected override void Dispose(bool disposing)   // It is important to release references here and not within the overridden OnDeactivated method, because this Controller is deactivated when changing the current View variant.
 {
     if (disposing)
     {
         UnsubscribeFromEvents();
         changeVariantController = null;
         variantsProvider        = null;
         rootModelViewVariants   = null;
         modelViews = null;
     }
     base.Dispose(disposing);
 }