/// <summary>
    /// Create the payment account for the provider at the payment gateway (Braintree) given
    /// its Loconomics UserID.
    /// On Braintree Marketplace, this is called 'Create a Sub Merchant'
    /// </summary>
    /// <param name="providerID"></param>
    /// <param name="gateway"></param>
    /// <returns>It returns the result of the Braintree transaction (check for IsSuccess to know the result),
    /// or null when there Braintree doesn't authorize the operation (AuthorizationException catched) or there is
    /// not enough information for that userID, both cases it means the details are not complete or malformed.</returns>
    public static Result <MerchantAccount> CreateProviderPaymentAccount(int providerID, BraintreeGateway gateway = null)
    {
        gateway = NewBraintreeGateway(gateway);
        var provider = LcData.UserInfo.GetUserRowWithContactData(providerID);
        var address  = LcData.GetFirstUserAddressOfType(providerID, LcData.Address.AddressType.Billing);
        var bank     = LcData.UserInfo.GetUserBankInfo(providerID);

        if (provider != null && address != null)
        {
            return(CreateProviderPaymentAccount(provider, address, bank.ABANumber, gateway));
        }
        return(null);
    }