/// <summary>
        ///     The process record method.
        /// </summary>
        protected override void ProcessRecord()
        {
            ResponseType response = null;

            base.ProcessRecord();
            try
            {
                if (NetworkDomain != null)
                {
                    NetworkDomainId = NetworkDomain.id;
                }

                if (ChildPortList != null && ChildPortList.Length > 0)
                {
                    ChildPortListId = ChildPortList.Select(x => x.id).ToArray();
                }

                var portList = new createPortList
                {
                    networkDomainId = NetworkDomainId,
                    name            = Name,
                    description     = Description,
                    childPortListId = ChildPortListId,
                    port            = Port != null?
                                      Port.Select(x => new PortRangeType
                    {
                        begin        = x.Begin.Value,
                        end          = x.End.HasValue ? x.End.Value : (ushort)0,
                        endSpecified = x.End.HasValue
                    }).ToArray()
                                          : null,
                };

                response = Connection.ApiClient.Networking.FirewallRule.CreatePortList(portList).Result;
            }
            catch (AggregateException ae)
            {
                ae.Handle(
                    e =>
                {
                    if (e is ComputeApiException)
                    {
                        WriteError(new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection));
                    }
                    else
                    {
                        // if (e is HttpRequestException)
                        ThrowTerminatingError(new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection));
                    }

                    return(true);
                });
            }

            WriteObject(response);
        }
 /// <summary>
 /// Creates an ip address list.
 /// </summary>
 /// <param name="createPortList">The ip address list details.</param>
 /// <returns>The response details.</returns>
 public async Task <ResponseType> CreatePortList(createPortList createPortList)
 {
     return(await _api.PostAsync <createPortList, ResponseType>(
                ApiUris.CreatePortList(_api.OrganizationId),
                createPortList));
 }