public static Long getNumberOfImagesByTag(Instagram instagram, String tag) {
    // Get information about a tag object.
    TagInfoFeed tagFeed = null;
    try {
      tagFeed = instagram.getTagInfo(appDisplayNameTag);
    } catch (InstagramException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    TagInfoData tagData = tagFeed.getTagInfo();

    return tagData.getMediaCount();
  } // getNumberOfImagesByTag
  public static TagMediaFeed getMediaFeed(Instagram instagram) {
    Logger.info("  --Media feed-----------------");

    TagMediaFeed mediaFeed = null;
    try {
      mediaFeed = instagram.getRecentMediaTags(appDisplayNameTag);

    } catch (InstagramException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return mediaFeed;
  } // getMediaFeed
  public static TagMediaFeed getNextMediaFeed(Instagram instagram, String nextMaxId) {
    Logger.info("  --Media feed next-------------");

    TagMediaFeed mediaFeed = null;
    try {
      // add pagination
      Map<String, String> params = new HashMap<String, String>();

      params.put(QueryParam.MAX_ID, nextMaxId);

      // mediaFeed1 = instagram.getRecentMediaTags(tagName);
      mediaFeed = instagram.getRecentMediaTagsWithParams(appDisplayNameTag, params);

    } catch (InstagramException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return mediaFeed;
  } // getNextMediaFeed