/// <summary>
        /// Generates a RecordType parameter
        /// </summary>
        /// <param name="required">Specifies if this parameter is mandatory</param>
        /// <returns></returns>
        internal static RuntimeDefinedParameter RecordType(bool required = false)
        {
            RuntimeDefinedParameter Param = new RuntimeDefinedParameter()
            {
                Name          = "RecordType",
                ParameterType = typeof(String)
            };

            Param.Attributes.Add(new ParameterAttribute()
            {
                Mandatory   = required,
                HelpMessage = "The type of record to create."
            });

            Param.Attributes.Add(new ValidateSetAttribute(IBXCommonMethods.GetDnsRecordTypes().Select(x => x.ToString()).ToArray()));
            return(Param);
        }
        private void ProcessByReference()
        {
            string[] Temp = base._Ref.Split('/');
            if (Temp.Length > 0)
            {
                try
                {
                    base.ObjectType = IBXCommonMethods.GetInfobloxObjectEnumFromName(Temp[0]);

                    StringWriter SWriter     = new StringWriter();
                    TextWriter   OriginalOut = Console.Out;
                    Console.SetOut(SWriter);

                    try
                    {
                        base.ObjectResponse = typeof(IBXCommonMethods).GetMethod("GetIbxObject").MakeGenericMethod(base.ObjectType.GetObjectType()).InvokeGenericAsync(base.IBX, new object[] { base._Ref, base._FieldsToReturn }).Result;
                    }
                    catch (AggregateException ae)
                    {
                        PSCommon.WriteExceptions(ae, this.Host);
                        this.ThrowTerminatingError(new ErrorRecord(ae.InnerException, ae.InnerException.GetType().FullName, ErrorCategory.NotSpecified, this));
                    }
                    catch (Exception e)
                    {
                        PSCommon.WriteExceptions(e, this.Host);
                        this.ThrowTerminatingError(new ErrorRecord(e, e.GetType().FullName, ErrorCategory.NotSpecified, this));
                    }
                    finally
                    {
                        WriteVerbose(SWriter.ToString());
                        Console.SetOut(OriginalOut);
                    }
                }
                catch (Exception e)
                {
                    PSCommon.WriteExceptions(e, this.Host);
                    this.ThrowTerminatingError(new ErrorRecord(e, e.GetType().FullName, ErrorCategory.NotSpecified, this));
                }
            }
            else
            {
                throw new PSArgumentException("The reference value was not properly formatted.");
            }
        }
        protected override void BeginProcessing()
        {
            try
            {
                if (this.ParameterSetName.StartsWith(_GRID))
                {
                    if (this.Version.Equals("LATEST"))
                    {
                        using (HttpClient Client = CommandHelpers.BuildHttpClient(this.GridMaster, "1.0", this.Credential.UserName, this.Credential.Password, TimeSpan.FromSeconds(Timeout)).Result)
                        {
                            WriteVerbose("Getting supported versions.");

                            HttpResponseMessage Response = Client.GetAsync("?_schema").Result;

                            WriteVerbose(Response.RequestMessage.RequestUri.ToString());

                            if (Response.IsSuccessStatusCode)
                            {
                                string Content = Response.Content.ReadAsStringAsync().Result;

                                WriteVerbose($"Response {Content}");

                                dynamic Obj = JsonConvert.DeserializeObject(Content);
                                IEnumerable <string> Versions = Obj.supported_versions;

                                WriteVerbose("Got versions");

                                Versions = Versions.Select(x => { return(new Version(x)); }).OrderByDescending(x => x).Select(x => { return(x.ToString()); });

                                WriteVerbose("Sorted versions");
                                this.Version = Versions.First();
                                WriteVerbose($"Latest supported version is {this.Version}");
                            }
                            else
                            {
                                WriteVerbose("Failed to get schema, reverting to using version 2.0");
                                this.Version = "2.0";
                            }
                        }
                    }

                    this._IBX = new IBXCommonMethods(this.GridMaster, this.Version, this.Credential.UserName, this.Credential.Password, TimeSpan.FromSeconds(Timeout));
                }
                else if (this.ParameterSetName.StartsWith(_SESSION))
                {
                    this._IBX = new IBXCommonMethods(this.Session, TimeSpan.FromSeconds(Timeout));
                }
                else if (this.ParameterSetName.StartsWith(_ENTERED_SESSION))
                {
                    this._IBX = new IBXCommonMethods(TimeSpan.FromSeconds(Timeout));
                }
                else
                {
                    this.ThrowTerminatingError(new ErrorRecord(new PSArgumentException($"Could not identify parameter set from {this.ParameterSetName}"), "PSArgumentException", ErrorCategory.InvalidArgument, this));
                }
            }
            catch (AggregateException ae)
            {
                PSCommon.WriteExceptions(ae, this.Host);
                this.ThrowTerminatingError(new ErrorRecord(ae.InnerException, ae.InnerException.GetType().FullName, ErrorCategory.NotSpecified, this));
            }
            catch (Exception e)
            {
                PSCommon.WriteExceptions(e, this.Host);
                this.ThrowTerminatingError(new ErrorRecord(e, e.GetType().FullName, ErrorCategory.NotSpecified, this));
            }
        }