/// <summary>Performs execution of the command, working asynchronously if required.</summary>
        /// <returns>
        /// A <see cref="System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed.
        /// </returns>
        protected async System.Threading.Tasks.Task ProcessRecordAsync()
        {
            QueryBody.ApiVersion = "3.1";
            using ( NoSynchronizationContext )
            {
                await((Microsoft.Rest.ClientRuntime.IEventListener) this).Signal(Microsoft.Rest.ClientRuntime.Events.CmdletGetPipeline); if (((Microsoft.Rest.ClientRuntime.IEventListener) this).Token.IsCancellationRequested)
                {
                    return;
                }
                if (SkipSSL.ToBool())
                {
                    Pipeline = Nutanix.Powershell.Module.Instance.CreatePipelineWithProxy(this.MyInvocation.BoundParameters);
                }
                else
                {
                    Pipeline = Nutanix.Powershell.Module.Instance.CreatePipeline(this.MyInvocation.BoundParameters);
                }
                Pipeline.Prepend(HttpPipelinePrepend);
                Pipeline.Append(HttpPipelineAppend);
                // get the client instance
                if (Credential == null)
                {
                    if (Port == null)
                    {
                        Port = System.Environment.GetEnvironmentVariable("NutanixPort") ?? "9440";
                    }

                    if (Protocol == null)
                    {
                        Protocol = System.Environment.GetEnvironmentVariable("NutanixProtocol") ?? "https";
                    }

                    if (Server == null)
                    {
                        Server = System.Environment.GetEnvironmentVariable("NutanixServer") ?? "localhost";
                    }

                    if (Username == null)
                    {
                        Username = System.Environment.GetEnvironmentVariable("NutanixUsername") ?? "";
                    }

                    if (Password == null)
                    {
                        var psw = System.Environment.GetEnvironmentVariable("NutanixPassword") ?? "";
                        System.Security.SecureString result = new System.Security.SecureString();
                        foreach (char c in psw)
                        {
                            result.AppendChar(c);
                        }

                        Password = result;
                    }
                    //build url
                    var url = $"{Protocol}://{Server}:{Port}";
                    Credential = new Nutanix.Powershell.Models.NutanixCredential(url, Username, Password);
                }
                await((Microsoft.Rest.ClientRuntime.IEventListener) this).Signal(Microsoft.Rest.ClientRuntime.Events.CmdletBeforeAPICall); if (((Microsoft.Rest.ClientRuntime.IEventListener) this).Token.IsCancellationRequested)
                {
                    return;
                }
                await this.Client.ListEntitiesByCategory(QueryBody, onOK, onDefault, this, Pipeline, Credential);

                await((Microsoft.Rest.ClientRuntime.IEventListener) this).Signal(Microsoft.Rest.ClientRuntime.Events.CmdletAfterAPICall); if (((Microsoft.Rest.ClientRuntime.IEventListener) this).Token.IsCancellationRequested)
                {
                    return;
                }
            }
        }