private PSVirtualNetworkGatewayConnection CreateVirtualNetworkGatewayConnection()
        {
            var vnetGatewayConnection = new PSVirtualNetworkGatewayConnection();
            vnetGatewayConnection.Name = this.Name;
            vnetGatewayConnection.ResourceGroupName = this.ResourceGroupName;
            vnetGatewayConnection.Location = this.Location;
            vnetGatewayConnection.VirtualNetworkGateway1 = this.VirtualNetworkGateway1;
            vnetGatewayConnection.VirtualNetworkGateway2 = this.VirtualNetworkGateway2;
            vnetGatewayConnection.LocalNetworkGateway2 = this.LocalNetworkGateway2;
            vnetGatewayConnection.ConnectionType = this.ConnectionType;
            vnetGatewayConnection.RoutingWeight = this.RoutingWeight;
            vnetGatewayConnection.SharedKey = this.SharedKey;

            if (!string.IsNullOrEmpty(this.EnableBgp))
            {
                vnetGatewayConnection.EnableBgp = bool.Parse(this.EnableBgp);
            }
            else
            {
                vnetGatewayConnection.EnableBgp = false;
            }

            if (!string.IsNullOrEmpty(this.AuthorizationKey))
            {
                vnetGatewayConnection.AuthorizationKey = this.AuthorizationKey;
            }


            if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResource))
            {
                if (this.Peer != null)
                {
                    this.PeerId = this.Peer.Id;
                }
            }

            if (!string.IsNullOrEmpty(this.PeerId))
            {
                vnetGatewayConnection.Peer = new PSResourceId();
                vnetGatewayConnection.Peer.Id = this.PeerId;
            }

            // Map to the sdk object
            var vnetGatewayConnectionModel = Mapper.Map<MNM.VirtualNetworkGatewayConnection>(vnetGatewayConnection);
            vnetGatewayConnectionModel.Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true);

            // Execute the Create VirtualNetworkConnection call
            this.VirtualNetworkGatewayConnectionClient.CreateOrUpdate(this.ResourceGroupName, this.Name, vnetGatewayConnectionModel);

            var getVirtualNetworkGatewayConnection = this.GetVirtualNetworkGatewayConnection(this.ResourceGroupName, this.Name);

            return getVirtualNetworkGatewayConnection;
        }
        private PSVirtualNetworkGatewayConnection CreateVirtualNetworkGatewayConnection()
        {
            var vnetGatewayConnection = new PSVirtualNetworkGatewayConnection();
            vnetGatewayConnection.Name = this.Name;
            vnetGatewayConnection.ResourceGroupName = this.ResourceGroupName;
            vnetGatewayConnection.Location = this.Location;
            vnetGatewayConnection.VirtualNetworkGateway1 = this.VirtualNetworkGateway1;
            vnetGatewayConnection.VirtualNetworkGateway2 = this.VirtualNetworkGateway2;
            vnetGatewayConnection.LocalNetworkGateway2 = this.LocalNetworkGateway2;
            vnetGatewayConnection.ConnectionType = this.ConnectionType;
            vnetGatewayConnection.RoutingWeight = this.RoutingWeight;
            vnetGatewayConnection.SharedKey = this.SharedKey;

            // Map to the sdk object
            var vnetGatewayConnectionModel = Mapper.Map<MNM.VirtualNetworkGatewayConnection>(vnetGatewayConnection);
            vnetGatewayConnectionModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayConnectionType;
            vnetGatewayConnectionModel.Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true);

            // Execute the Create VirtualNetworkConnection call
            this.VirtualNetworkGatewayConnectionClient.CreateOrUpdate(this.ResourceGroupName, this.Name, vnetGatewayConnectionModel);

            var getVirtualNetworkGatewayConnection = this.GetVirtualNetworkGatewayConnection(this.ResourceGroupName, this.Name);

            return getVirtualNetworkGatewayConnection;
        }