public bool ValidateAccount(int productId, AccountDetails accountDetails, out string messages) { bool result = true; messages = String.Empty; //Check that the product supports the currency. If ID is -1 ignore this check if (accountDetails.CurrencyId != -1) { var productCurrency = _cardManService.GetProductCurrencies(productId, accountDetails.CurrencyId, true, -2, "SYSTEM"); if (productCurrency == null || productCurrency.Count == 0) { result = false; messages = "Product does not support returned currency."; } } else { _log.Trace(t => t("CurrencyId set to -1, skipping currency check")); } //check that the product supports the account type. If ID is -1 ignore this check if (accountDetails.AccountTypeId != -1) { var productAccount = _cardManService.GetProductAccountTypes(productId, 0, -2, "SYSTEM"); if (productAccount == null || productAccount.Where(w => w.account_type_id == accountDetails.AccountTypeId).Count() == 0) { result = false; messages += (String.IsNullOrWhiteSpace(messages) ? "" : "<br />") + "Product does not support returned account type."; } } else { _log.Trace(t => t("AccountTypeId set to -1, skipping account type check")); } return(result); }