@Override
 public Account getAccountById(Long id) {
   return create()
       .selectFrom(ACCOUNT)
       .where(
           ACCOUNT
               .ID
               .eq(id)
               .and(ACCOUNT.STATE.ne(CommonStatesConstants.PURGED))
               .and(ACCOUNT.REMOVED.isNull()))
       .fetchOne();
 }
 @Override
 public Account getAccountByExternalId(String externalId, String externalType) {
   return create()
       .selectFrom(ACCOUNT)
       .where(
           ACCOUNT
               .EXTERNAL_ID
               .eq(externalId)
               .and(ACCOUNT.EXTERNAL_ID_TYPE.eq(externalType))
               .and(ACCOUNT.STATE.ne("purged")))
       .orderBy(ACCOUNT.ID.asc())
       .fetchOne();
 }