protected PowerShellResults <O> GetObject <O>(PSCommand psCommand, Identity identity)
        {
            EcpPerfCounters.WebServiceGetObject.Increment();
            identity.FaultIfNull();
            PowerShellResults <O> powerShellResults = this.CoreInvoke <O>(psCommand, identity.ToPipelineInput(), identity, null);

            if (powerShellResults.Output.Length > 1)
            {
                throw new SecurityException(Strings.ErrorManagementObjectAmbiguous(identity.DisplayName));
            }
            return(powerShellResults);
        }
        protected PowerShellResults <L> SetObject <O, U, L>(string setCmdlet, Identity identity, U properties, Identity identityForGetCmdlet) where O : L where U : SetObjectProperties
        {
            EcpPerfCounters.WebServiceSetObject.Increment();
            identity.FaultIfNull();
            properties.FaultIfNull();
            PowerShellResults <L> powerShellResults = new PowerShellResults <L>();

            properties.IgnoreNullOrEmpty = false;
            if (properties.Any <KeyValuePair <string, object> >())
            {
                powerShellResults = this.CoreInvoke <L>(new PSCommand().AddCommand(setCmdlet), identity.ToPipelineInput(), identity, properties);
            }
            if (powerShellResults.Succeeded && null != identityForGetCmdlet)
            {
                PowerShellResults <L> powerShellResults2 = null;
                if (properties.ReturnObjectType == ReturnObjectTypes.Full && this is IGetObjectService <O> )
                {
                    IGetObjectService <O> getObjectService = this as IGetObjectService <O>;
                    PowerShellResults <O> @object          = getObjectService.GetObject(identityForGetCmdlet);
                    powerShellResults2 = new PowerShellResults <L>();
                    powerShellResults2.MergeOutput(@object.Output.Cast <L>().ToArray <L>());
                    powerShellResults2.MergeErrors <O>(@object);
                }
                else if (properties.ReturnObjectType == ReturnObjectTypes.PartialForList && this is IGetObjectForListService <L> )
                {
                    IGetObjectForListService <L> getObjectForListService = this as IGetObjectForListService <L>;
                    powerShellResults2 = getObjectForListService.GetObjectForList(identityForGetCmdlet);
                }
                if (powerShellResults2 != null)
                {
                    powerShellResults.MergeAll(powerShellResults2);
                }
            }
            return(powerShellResults);
        }