public static List<Group> getFavoriteSitesGroups(long userId, String name, int start, int end)
      throws Exception {

    List<Object[]> favoriteSites =
        FavoriteSiteLocalServiceUtil.getFavoriteSites(userId, name, start, end);

    List<Group> groups = new ArrayList<Group>(favoriteSites.size());

    for (Object[] favoriteSite : favoriteSites) {
      long curUserId = (Long) favoriteSite[0];
      long groupId = (Long) favoriteSite[1];

      try {
        groups.add(GroupServiceUtil.getGroup(groupId));
      } catch (Exception e) {
        FavoriteSiteLocalServiceUtil.deleteFavoriteSite(curUserId, groupId);
      }
    }

    return groups;
  }
  public static int getFavoriteSitesGroupsCount(long userId, String name) throws Exception {

    return FavoriteSiteLocalServiceUtil.getFavoriteSitesCount(userId, name);
  }