@Override
  public MBStatsUser addStatsUser(long groupId, long userId) {
    long statsUserId = counterLocalService.increment();

    MBStatsUser statsUser = mbStatsUserPersistence.create(statsUserId);

    statsUser.setGroupId(groupId);
    statsUser.setUserId(userId);

    try {
      mbStatsUserPersistence.update(statsUser);
    } catch (SystemException se) {
      if (_log.isWarnEnabled()) {
        _log.warn("Add failed, fetch {groupId=" + groupId + ", userId=" + userId + "}");
      }

      statsUser = mbStatsUserPersistence.fetchByG_U(groupId, userId, false);

      if (statsUser == null) {
        throw se;
      }
    }

    return statsUser;
  }
  public MBStatsUser getStatsUser(long groupId, long userId)
      throws PortalException, SystemException {

    MBStatsUser statsUser = mbStatsUserPersistence.fetchByG_U(groupId, userId);

    if (statsUser == null) {
      long statsUserId = counterLocalService.increment();

      statsUser = mbStatsUserPersistence.create(statsUserId);

      statsUser.setGroupId(groupId);
      statsUser.setUserId(userId);

      mbStatsUserPersistence.update(statsUser);
    }

    return statsUser;
  }