private static void localRevertFollowFeedId(long feedId, boolean isAskingToFollow) {
   ReaderBlogTable.setIsFollowedFeedId(feedId, !isAskingToFollow);
   ReaderPostTable.setFollowStatusForPostsInFeed(feedId, !isAskingToFollow);
 }
  private static boolean internalFollowFeed(
      final long feedId,
      final String feedUrl,
      final boolean isAskingToFollow,
      final ActionListener actionListener) {
    // feedUrl is required
    if (TextUtils.isEmpty(feedUrl)) {
      if (actionListener != null) {
        actionListener.onActionResult(false);
      }
      return false;
    }

    if (feedId != 0) {
      ReaderBlogTable.setIsFollowedFeedId(feedId, isAskingToFollow);
      ReaderPostTable.setFollowStatusForPostsInFeed(feedId, isAskingToFollow);
    }

    if (isAskingToFollow) {
      AnalyticsTracker.track(AnalyticsTracker.Stat.READER_BLOG_FOLLOWED);
    } else {
      AnalyticsTracker.track(AnalyticsTracker.Stat.READER_BLOG_UNFOLLOWED);
    }

    final String actionName = (isAskingToFollow ? "follow" : "unfollow");
    final String path =
        "read/following/mine/"
            + (isAskingToFollow ? "new" : "delete")
            + "?url="
            + UrlUtils.urlEncode(feedUrl);

    com.wordpress.rest.RestRequest.Listener listener =
        new RestRequest.Listener() {
          @Override
          public void onResponse(JSONObject jsonObject) {
            boolean success = isFollowActionSuccessful(jsonObject, isAskingToFollow);
            if (success) {
              AppLog.d(T.READER, "feed " + actionName + " succeeded");
            } else {
              AppLog.w(
                  T.READER,
                  "feed " + actionName + " failed - " + jsonToString(jsonObject) + " - " + path);
              localRevertFollowFeedId(feedId, isAskingToFollow);
            }
            if (actionListener != null) {
              actionListener.onActionResult(success);
            }
          }
        };
    RestRequest.ErrorListener errorListener =
        new RestRequest.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError volleyError) {
            AppLog.w(T.READER, "feed " + actionName + " failed with error");
            AppLog.e(T.READER, volleyError);
            localRevertFollowFeedId(feedId, isAskingToFollow);
            if (actionListener != null) {
              actionListener.onActionResult(false);
            }
          }
        };
    WordPress.getRestClientUtilsV1_1().post(path, listener, errorListener);

    return true;
  }