public GLAccount getAccountByIdAndType(final String paramName, final GLAccountType expectedAccountType, final Long accountId) {
final GLAccount glAccount = this.accountRepository.findOne(accountId);
if (glAccount == null) { throw new GLAccountNotFoundException(accountId); }
// validate account is of the expected Type
if (glAccount.getType().intValue() != expectedAccountType.getValue()) { throw new ProductToGLAccountMappingInvalidException(
paramName, glAccount.getName(), accountId, GLAccountType.fromInt(glAccount.getType()).toString(),
expectedAccountType.toString()); }
return glAccount;
}