/// <summary>
        /// The create InputObject.
        /// </summary>
        /// <returns>
        /// The <see cref="PSPeering"/>.
        /// </returns>
        /// <exception cref="Exception">
        /// </exception>
        private PSExchangeConnection CreateExchangePeeringConnection()
        {
            var peeringRequest = new PSExchangeConnection
            {
                BgpSession = new PSBgpSession
                {
                    MaxPrefixesAdvertisedV4 = !string.IsNullOrEmpty(this.PeerSessionIPv4Address) ? (this.MaxPrefixesAdvertisedIPv4 ?? 20000) : (int?)null,
                    MaxPrefixesAdvertisedV6 = !string.IsNullOrEmpty(this.PeerSessionIPv6Address) ? (this.MaxPrefixesAdvertisedIPv6 ?? 2000) : (int?)null,
                    Md5AuthenticationKey    = this.MD5AuthenticationKey,
                    PeerSessionIPv4Address  = this.PeerSessionIPv4Address,
                    PeerSessionIPv6Address  = this.PeerSessionIPv6Address
                },
                PeeringDBFacilityId = this.PeeringDBFacilityId,
            };

            if (this.IsValidConnection(peeringRequest))
            {
                return(peeringRequest);
            }

            throw new PSArgumentException(string.Format(Resources.Error_InvalidConnection));
        }
        /// <inheritdoc />
        /// <summary>
        ///     The base execute operation.
        /// </summary>
        public override void Execute()
        {
            try
            {
                base.Execute();
                PSExchangeConnection newRequest = null;
                if (this.ParameterSetName.Equals(
                        Constants.ParameterSetNameIPv4Address,
                        StringComparison.OrdinalIgnoreCase))
                {
                    newRequest = this.UpdateIpV4Prefix();
                }
                else if (this.ParameterSetName.Equals(
                             Constants.ParameterSetNameIPv6Address,
                             StringComparison.OrdinalIgnoreCase))
                {
                    newRequest = this.UpdateIpV6Prefix();
                }
                else if (this.ParameterSetName.Equals(
                             Constants.ParameterSetNameMd5Authentication,
                             StringComparison.OrdinalIgnoreCase))
                {
                    newRequest = this.UpdateMD5Authentication();
                }

                this.WriteObject(newRequest);
            }
            catch (InvalidOperationException mapException)
            {
                throw new InvalidOperationException(string.Format(Resources.Error_Mapping, mapException));
            }
            catch (ErrorResponseException ex)
            {
                var error = this.GetErrorCodeAndMessageFromArmOrErm(ex);
                throw new ErrorResponseException(string.Format(Resources.Error_CloudError, error.Code, error.Message));
            }
        }
        /// <inheritdoc />
        /// <summary>
        ///     The base execute operation.
        /// </summary>
        public override void Execute()
        {
            try
            {
                base.Execute();
                PSExchangeConnection newRequest = null;
                if (this.ParameterSetName.Equals(
                        Constants.ParameterSetNameIPv4Address,
                        StringComparison.OrdinalIgnoreCase))
                {
                    newRequest = this.UpdateIpV4Prefix();
                }
                else if (this.ParameterSetName.Equals(
                             Constants.ParameterSetNameIPv6Address,
                             StringComparison.OrdinalIgnoreCase))
                {
                    newRequest = this.UpdateIpV6Prefix();
                }
                else if (this.ParameterSetName.Equals(
                             Constants.ParameterSetNameMd5Authentication,
                             StringComparison.OrdinalIgnoreCase))
                {
                    newRequest = this.UpdateMD5Authentication();
                }

                this.WriteObject(newRequest);
            }
            catch (InvalidOperationException mapException)
            {
                throw new InvalidOperationException(string.Format(Resources.Error_Mapping, mapException));
            }
            catch (ErrorResponseException ex)
            {
                var error = ex.Response.Content.Contains("\"error\\\":") ? JsonConvert.DeserializeObject <Dictionary <string, ErrorResponse> >(JsonConvert.DeserializeObject(ex.Response.Content).ToString()).FirstOrDefault().Value : JsonConvert.DeserializeObject <ErrorResponse>(ex.Response.Content);
                throw new ErrorResponseException(string.Format(Resources.Error_CloudError, error.Code, error.Message));
            }
        }