public static MultiValuedProperty <ADObjectId> ValidateServers(ADPropertyDefinition propertyDefinition, IConfigDataProvider session, MultiValuedProperty <ServerIdParameter> servers, HybridConfigurationTaskUtility.GetUniqueObject getServer, Task.TaskErrorLoggingDelegate writeError, params HybridConfigurationTaskUtility.ServerCriterion[] serverCriteria) { MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, propertyDefinition, new object[0]); if (servers != null) { foreach (ServerIdParameter serverIdParameter in servers) { if (serverIdParameter != null) { Server server = getServer(serverIdParameter, session, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))) as Server; if (server != null) { if (serverCriteria != null) { foreach (HybridConfigurationTaskUtility.ServerCriterion serverCriterion in serverCriteria) { if (!serverCriterion.DoesMeet(server)) { writeError(new InvalidOperationException(serverCriterion.Error(server.ToString())), ErrorCategory.InvalidOperation, server.ToString()); } } } if (multiValuedProperty.Contains((ADObjectId)server.Identity)) { writeError(new InvalidOperationException(HybridStrings.ErrorHybridServerAlreadyAssigned(server.Identity.ToString())), ErrorCategory.InvalidOperation, server.ToString()); } else { multiValuedProperty.Add(((ADObjectId)server.Identity).DistinguishedName); } } } } } return(multiValuedProperty); }