protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            bool advancedHydrateableObjectsSharedEnabled = this.newServicePlanSettings.Organization.AdvancedHydrateableObjectsSharedEnabled;

            base.InternalCreateSharedConfiguration = (this.oldServicePlanSettings.Organization.ShareableConfigurationEnabled && this.newServicePlanSettings.Organization.ShareableConfigurationEnabled && this.tenantCU.SupportedSharedConfigurations.Count == 0);
            base.InternalIsSharedConfigServicePlan = this.config.IsSharedConfigurationAllowedForServicePlan(this.newServicePlanSettings);
            this.monadConnection.RunspaceProxy.SetVariable("TargetServicePlan", this.newServicePlan);
            this.monadConnection.RunspaceProxy.SetVariable("TargetProgramId", this.targetProgramId);
            this.monadConnection.RunspaceProxy.SetVariable("TargetOfferId", this.targetOfferId);
            if (this.tenantCU.ServicePlan == this.newServicePlan)
            {
                base.WriteVerbose(Strings.VerboseWillSkipUpdateServicePlan(this.Identity.ToString()));
            }
            else if (!ServicePlan.CompareAndCalculateDelta(this.oldServicePlanSettings, this.newServicePlanSettings, this.IsCrossSKUMigration, out this.deltaServicePlanSettings, out this.featuresToApply))
            {
                base.WriteVerbose(Strings.VerboseWillUpgradeServicePlan(this.Identity.ToString(), this.tenantCU.ServicePlan, this.newServicePlan));
                if (advancedHydrateableObjectsSharedEnabled)
                {
                    string text;
                    if (!this.config.TryGetHydratedOfferId(this.targetProgramId, this.targetOfferId, out text))
                    {
                        text = this.targetOfferId;
                    }
                    SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.targetProgramId, text);
                    OrganizationId          organizationId          = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, this.tenantCU.OrganizationId.PartitionId);
                    if (organizationId == null)
                    {
                        base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationNotFound(this.targetProgramId, text, sharedConfigurationInfo.CurrentVersion.ToString())), (ErrorCategory)1000, null);
                    }
                    else
                    {
                        this.monadConnection.RunspaceProxy.SetVariable("TargetSharedConfiguration", organizationId.OrganizationalUnit.Name);
                    }
                }
                if (ManageServicePlanMigrationBase.MailboxPlanConfigurationChanged(this.deltaServicePlanSettings))
                {
                    ManageServicePlanMigrationBase.CopyEnabledMailboxPlanRoleAssignmentFeatures(this.deltaServicePlanSettings, this.newServicePlanSettings);
                }
                this.newServicePlanSettings.Name = "new";
                base.InternalProcessRecord();
                if (this.configOnly)
                {
                    this.WriteWarning(Strings.WarningUpgradeIsNotComplete(this.UpgradePhase.ToString()));
                }
            }
            else
            {
                base.WriteVerbose(Strings.VerboseWillSkipUpdateServicePlan(this.Identity.ToString()));
            }
            TaskLogger.LogExit();
        }
        protected override void FilterComponents()
        {
            base.FilterComponents();
            if (this.deltaServicePlanSettings != null)
            {
                bool recreateCannedRBACRoles             = ManageServicePlanMigrationBase.CannedRolesChanged(this.deltaServicePlanSettings);
                bool rolesToRoleGroupAssignmentsChange   = ManageServicePlanMigrationBase.RoleToRoleGroupsAssignmentsChanged(this.deltaServicePlanSettings);
                bool shareableConfigurationEnabledChange = ManageServicePlanMigrationBase.RBACConfigPresenceChanged(this.deltaServicePlanSettings);
                bool createNewMailboxPlanObject          = (this.conservative || ManageServicePlanMigrationBase.MailboxPlanConfigurationChanged(this.deltaServicePlanSettings)) && !this.IsCrossSKUMigration && !base.InternalPilotEnabled;
                foreach (SetupComponentInfo setupComponentInfo in base.ComponentInfoList)
                {
                    setupComponentInfo.Tasks.RemoveAll(delegate(TaskInfo taskInfo)
                    {
                        ServicePlanTaskInfo servicePlanTaskInfo = taskInfo as ServicePlanTaskInfo;
                        if (servicePlanTaskInfo == null)
                        {
                            return(true);
                        }
                        string featureName;
                        switch (featureName = servicePlanTaskInfo.FeatureName)
                        {
                        case "LoadSetupSnapin":
                        case "ServicePlanUpgradeStart":
                        case "PerMBXPlanRoleAssignmentPolicyEnabled":
                        case "PerMBXPlanRetentionPolicyEnabled":
                        case "PerMBXPlanOWAPolicyEnabled":
                        case "MailboxPlans":
                            return(false);

                        case "RecreateCannedRBACRoleGroups":
                            return(!rolesToRoleGroupAssignmentsChange);

                        case "RecreateCannedRBACRoles":
                            return(!recreateCannedRBACRoles && !shareableConfigurationEnabledChange && !rolesToRoleGroupAssignmentsChange);

                        case "RecreateCannedRBACRoleAssignments":
                            return(!rolesToRoleGroupAssignmentsChange && !shareableConfigurationEnabledChange);

                        case "CreateNewMailboxPlanObject":
                            return(!createNewMailboxPlanObject);

                        case "UpdateMailboxes":
                            {
                                bool flag  = this.UpgradePhase >= UpgradePhase.UpdateMailboxes;
                                bool flag2 = createNewMailboxPlanObject || this.IsCrossSKUMigration;
                                return(!flag || !flag2 || !this.includeUserUpdatePhase);
                            }

                        case "CleanupOldMailboxPlan":
                            {
                                bool flag  = this.UpgradePhase == UpgradePhase.Cleanup;
                                bool flag2 = createNewMailboxPlanObject || this.IsCrossSKUMigration;
                                return(!flag || !flag2);
                            }

                        case "ServicePlanUpgradeEnd":
                            return(this.configOnly);
                        }
                        return(!this.featuresToApply.Contains(servicePlanTaskInfo.FeatureName));
                    });
                }
            }
        }