private static ProvisioningValidationError[] ValidateUserScopeImpl(Task task)
        {
            if (ProvisioningLayer.Disabled || !task.IsProvisioningLayerAvailable)
            {
                return(null);
            }
            List <ProvisioningValidationError> list = new List <ProvisioningValidationError>();

            for (int i = 0; i < task.ProvisioningHandlers.Length; i++)
            {
                using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, task.ProvisioningHandlers[i].AgentName, "ValidateUserScope", LoggerHelper.CmdletPerfMonitors))
                {
                    ProvisioningValidationError[] array = task.ProvisioningHandlers[i].ValidateUserScope();
                    if (array != null && array.Length > 0)
                    {
                        for (int j = 0; j < array.Length; j++)
                        {
                            array[j].AgentName = task.ProvisioningHandlers[i].AgentName;
                        }
                        list.AddRange(array);
                        if (task.IsVerboseOn)
                        {
                            task.WriteVerbose(TaskVerboseStringHelper.GetProvisioningValidationErrors(array, i));
                        }
                    }
                }
            }
            return(list.ToArray());
        }