/// <summary>
        /// InternalProcessRecord method override
        /// </summary>
        protected override void InternalProcessRecord()
        {
            SPFarm farm = SPFarm.Local;

            if (null == farm)
            {
                ThrowTerminatingError(new InvalidOperationException("SharePoint server farm not found."), ErrorCategory.ResourceUnavailable, this);
            }
            IdentityServiceProxy serviceProxy = farm.ServiceProxies.GetValue <IdentityServiceProxy>();

            if (null == serviceProxy)
            {
                ThrowTerminatingError(new InvalidOperationException("Identity Web Service proxy not found."), ErrorCategory.ResourceUnavailable, this);
            }
            ServiceApplicationProxy existingServiceApplicationProxy = serviceProxy.ApplicationProxies.GetValue <ServiceApplicationProxy>();

            if (null != existingServiceApplicationProxy)
            {
                WriteError(new InvalidOperationException("Identity Web service application proxy exists."), ErrorCategory.ResourceExists, existingServiceApplicationProxy);
                SkipProcessCurrentRecord();
            }
            Uri serviceApplicationUri = null;

            if (this.ParameterSetName == UriParameterSetName)
            {
                serviceApplicationUri = m_Uri;
            }
            else if (this.ParameterSetName == ServiceApplicationParameterSetName)
            {
                SPServiceApplication serviceApplication = m_ServiceApplicationPipeBind.Read();
                if (null == serviceApplication)
                {
                    WriteError(new InvalidOperationException("Service application not found."), ErrorCategory.ResourceExists, serviceApplication);
                    SkipProcessCurrentRecord();
                }
                ISharedServiceApplication sharedServiceApplication = serviceApplication as ISharedServiceApplication;
                if (null == sharedServiceApplication)
                {
                    WriteError(new InvalidOperationException("Connecting to the specified service application is not supported."), ErrorCategory.ResourceExists, serviceApplication);
                    SkipProcessCurrentRecord();
                }
                serviceApplicationUri = sharedServiceApplication.Uri;
            }
            else
            {
                ThrowTerminatingError(new InvalidOperationException("Invalid parameter set."), ErrorCategory.InvalidArgument, this);
            }
            if ((null != serviceApplicationUri) && (ShouldProcess(this.Name)))
            {
                ServiceApplicationProxy serviceApplicationProxy = new ServiceApplicationProxy(this.Name, serviceProxy, serviceApplicationUri);
                serviceApplicationProxy.Provision();
                WriteObject(serviceApplicationProxy);
            }
        }
        /// <summary>
        /// CheckApplicationProxy metho implementation
        /// </summary>
        private bool CheckApplicationProxy(IdentityServiceApplication app, ServiceApplicationProxy prxy)
        {
            bool result = false;

            try
            {
                string   path  = app.IisVirtualDirectoryPath;
                string[] xpath = path.Split('\\');
                result = (prxy.ServiceEndpointUri.ToString().ToLower().Contains(xpath[1]));
            }
            catch
            {
                result = false;
            }
            return(result);
        }