protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (!this.Force && !SetSyncServiceInstance.IsServiceInstanceEmpty(base.DataObject))
     {
         base.WriteError(new InvalidOperationException(Strings.CannotRemoveServiceInstanceError(base.DataObject.Name)), ErrorCategory.InvalidOperation, base.DataObject.Identity);
     }
     TaskLogger.LogExit();
 }
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            SyncServiceInstance syncServiceInstance = (SyncServiceInstance)base.PrepareDataObject();

            if (syncServiceInstance.IsChanged(ADObjectSchema.Name))
            {
                string text;
                syncServiceInstance.TryGetOriginalValue <string>(ADObjectSchema.Name, out text);
                if (!this.Force && !SetSyncServiceInstance.IsServiceInstanceEmpty(syncServiceInstance))
                {
                    base.WriteError(new InvalidOperationException(Strings.CannotChangeServiceInstanceNameError(text)), ErrorCategory.InvalidOperation, text);
                }
            }
            if (syncServiceInstance.IsChanged(SyncServiceInstanceSchema.ForwardSyncConfigurationXML))
            {
                string forwardSyncConfigurationXML = syncServiceInstance.ForwardSyncConfigurationXML;
                try
                {
                    XElement.Parse(forwardSyncConfigurationXML);
                }
                catch (XmlException ex)
                {
                    base.WriteError(new InvalidOperationException(Strings.InvalidForwardSyncConfigurationError(ex.Message)), ErrorCategory.InvalidOperation, ex.Message);
                }
            }
            if (base.Fields.IsModified(SyncServiceInstanceSchema.AccountPartition))
            {
                if (this.AccountPartition != null)
                {
                    AccountPartition accountPartition = (AccountPartition)base.GetDataObject <AccountPartition>(this.AccountPartition, this.ConfigurationSession, null, null, null);
                    syncServiceInstance.AccountPartition = accountPartition.Id;
                }
                else
                {
                    syncServiceInstance.AccountPartition = null;
                }
            }
            TaskLogger.LogExit();
            return(syncServiceInstance);
        }