public void registerUser(String username, String password) {

    try {

      userDao.registerUser(username, password);
    } catch (Exception ex) {
      if (!(ex instanceof DaoException)) {
        ex.printStackTrace();
      }
      throw new ServiceException();
    }
  }
  public boolean doesUserExist(String userName) {

    try {
      String userFromDB = userDao.getUserName(userName);

      if (null != userFromDB) {
        if (userFromDB.equals(userName)) {
          return true;
        }
      }
    } catch (Exception ex) {
      if (!(ex instanceof DaoException)) {
        ex.printStackTrace();
      }
      throw new ServiceException();
    }

    return false;
  }