private MultiValuedProperty <BindingMetadata> ValidateExchangeBindings(IEnumerable <string> bindings, int maxCount)
        {
            base.WriteVerbose(Strings.VerboseValidatingExchangeBinding);
            MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>();

            if (bindings.Any <string>())
            {
                List <string> list = (from binding in bindings
                                      where SourceValidator.IsWideScope(binding)
                                      select binding).ToList <string>();
                if (list.Any <string>())
                {
                    throw new ExCannotContainWideScopeBindingsException(string.Join(", ", list));
                }
                this.ExchangeBinding = NewCompliancePolicyBase.ValidateWideScopeBinding(this.ExchangeBinding, "All", "All", new BindingCannotCombineAllWithIndividualBindingsException("Exchange"));
                ExchangeValidator exchangeValidator = this.CreateExchangeValidator(true, "Validating ExchangeBinding");
                multiValuedProperty = exchangeValidator.ValidateRecipients(this.ExchangeBinding);
                if (this.ExchangeBinding.Count <string>() > 1000)
                {
                    throw new BindingCountExceedsLimitException("Exchange", 1000);
                }
            }
            NewCompliancePolicyBase.SetBindingsSubWorkload(multiValuedProperty, Workload.Exchange);
            return(multiValuedProperty);
        }
        private MultiValuedProperty <BindingMetadata> ValidateSharepointSitesForAdd(MultiValuedProperty <BindingMetadata> psObjectBindings, MultiValuedProperty <BindingMetadata> internalRemoveBindings, MultiValuedProperty <string> addBindingParameter, Workload subWorkload)
        {
            base.WriteVerbose(Strings.VerboseValidatingAddSharepointBinding);
            int existingSitesCount = SetCompliancePolicyBase.CalculateBindingCountAfterRemove(psObjectBindings, internalRemoveBindings);
            SharepointValidator sharepointValidator = this.CreateSharepointValidator("Validating AddSharepointBinding", existingSitesCount);
            MultiValuedProperty <BindingMetadata> multiValuedProperty = sharepointValidator.ValidateLocations(addBindingParameter);

            NewCompliancePolicyBase.SetBindingsSubWorkload(multiValuedProperty, subWorkload);
            return(multiValuedProperty);
        }
        private MultiValuedProperty <BindingMetadata> ValidateSharepointBindings(IEnumerable <string> bindings, Workload subWorkload, string workloadName, int maxCount)
        {
            base.WriteVerbose(Strings.VerboseValidatingSharepointBinding(workloadName));
            MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>();

            if (bindings.Any <string>())
            {
                bindings = NewCompliancePolicyBase.ValidateWideScopeBinding(bindings, "All", "All", new BindingCannotCombineAllWithIndividualBindingsException(workloadName));
                SharepointValidator sharepointValidator = this.CreateSharepointValidator(string.Format("Validating {0} Binding", workloadName));
                multiValuedProperty = sharepointValidator.ValidateLocations(bindings);
                if (multiValuedProperty.Count <BindingMetadata>() > maxCount)
                {
                    throw new BindingCountExceedsLimitException(workloadName, maxCount);
                }
                NewCompliancePolicyBase.SetBindingsSubWorkload(multiValuedProperty, subWorkload);
            }
            return(multiValuedProperty);
        }