protected override void InternalProcessRecord()
        {
            MalwareFilterRule malwareFilterRule = new MalwareFilterRule(null, base.Name, base.Priority, base.Enabled ? RuleState.Enabled : RuleState.Disabled, base.Comments, base.Conditions, base.Exceptions, new MalwareFilterPolicyIdParameter(this.policyObject.Name));
            int           priority      = base.Fields.IsModified("Priority") ? malwareFilterRule.Priority : -1;
            TransportRule transportRule = null;

            try
            {
                TransportRule        rule = malwareFilterRule.ToInternalRule();
                ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager(this.ruleCollectionName, base.DataSession);
                adruleStorageManager.LoadRuleCollection();
                adruleStorageManager.NewRule(rule, this.ResolveCurrentOrganization(), ref priority, out transportRule);
            }
            catch (RulesValidationException exception)
            {
                base.WriteError(exception, ErrorCategory.InvalidArgument, base.Name);
            }
            catch (InvalidPriorityException exception2)
            {
                base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
            }
            catch (ParserException exception3)
            {
                base.WriteError(exception3, ErrorCategory.InvalidData, null);
            }
            malwareFilterRule.Priority = priority;
            malwareFilterRule.SetTransportRule(transportRule);
            base.WriteObject(malwareFilterRule);
        }
        protected override void InternalProcessRecord()
        {
            HostedContentFilterRule hostedContentFilterRule = new HostedContentFilterRule(null, base.Name, base.Priority, base.Enabled ? RuleState.Enabled : RuleState.Disabled, base.Comments, base.Conditions, base.Exceptions, new HostedContentFilterPolicyIdParameter(this.policyObject.Name));

            if (this.policyObject.EnableEndUserSpamNotifications && !hostedContentFilterRule.IsEsnCompatible)
            {
                base.WriteError(new OperationNotAllowedException(Strings.ErrorCannotScopeEsnPolicy(this.policyObject.Name)), ErrorCategory.InvalidOperation, null);
            }
            int           priority      = base.Fields.IsModified("Priority") ? hostedContentFilterRule.Priority : -1;
            TransportRule transportRule = null;

            try
            {
                TransportRule        rule = hostedContentFilterRule.ToInternalRule();
                ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager(this.ruleCollectionName, base.DataSession);
                adruleStorageManager.LoadRuleCollection();
                adruleStorageManager.NewRule(rule, this.ResolveCurrentOrganization(), ref priority, out transportRule);
                FfoDualWriter.SaveToFfo <TransportRule>(this, transportRule, TenantSettingSyncLogType.DUALSYNCTR, null);
            }
            catch (RulesValidationException exception)
            {
                base.WriteError(exception, ErrorCategory.InvalidArgument, base.Name);
            }
            catch (InvalidPriorityException exception2)
            {
                base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
            }
            catch (ParserException exception3)
            {
                base.WriteError(exception3, ErrorCategory.InvalidData, null);
            }
            hostedContentFilterRule.Priority = priority;
            hostedContentFilterRule.SetTransportRule(transportRule);
            base.WriteObject(hostedContentFilterRule);
        }