code: public Request getRequestForPagedResults(PagingDirection direction) {
          String link = null;
          if (graphObject != null) {
              PagedResults pagedResults = graphObject.cast(PagedResults.class);
              PagingInfo pagingInfo = pagedResults.getPaging();
              if (pagingInfo != null) {
                  if (direction == PagingDirection.NEXT) {
                      link = pagingInfo.getNext();
                  } else {
                      link = pagingInfo.getPrevious();
                  }
              }
          }
          if (Utility.isNullOrEmpty(link)) {
              return null;
          }
  
          if (link != null && link.equals(request.getUrlForSingleRequest())) {
              // We got the same "next" link as we just tried to retrieve. This could happen if cached
              // data is invalid. All we can do in this case is pretend we have finished.
              return null;
          }
  
          Request pagingRequest;
          try {
              pagingRequest = new Request(request.getSession(), new URL(link));
          } catch (MalformedURLException e) {
              return null;
          }
  
          return pagingRequest;
      }
docs: If a Response contains results that contain paging information, returns a new
  Request that will retrieve the next page of results, in whichever direction
  is desired. If no paging information is available, returns null.
  
  @param direction enum indicating whether to page forward or backward
  @return a Request that will retrieve the next page of results in the desired
  direction, or null if no paging information is available