/**
   * Get the next page of resources
   *
   * @return true if more pages
   * @throws TestpressException
   */
  public boolean next() throws TestpressException {
    boolean emptyPage = false;
    try {
      for (int i = 0; i < count && hasNext(); i++) {
        Response<TestpressApiResponse<E>> retrofitResponse = getItems(page, -1);
        List<E> resourcePage;
        if (retrofitResponse.isSuccessful()) {
          response = retrofitResponse.body();
          resourcePage = response.getResults();
        } else {
          hasMore = false;
          throw TestpressException.httpError(retrofitResponse);
        }
        emptyPage = resourcePage.isEmpty();
        if (emptyPage) break;
        for (E resource : resourcePage) {
          resource = register(resource);
          if (resource == null) continue;
          resources.put(getId(resource), resource);
        }
        page++;
      }
      // Set count value to 1 if first load request made after call clear()
      if (count > 1) {
        count = 1;
      }

    } catch (Exception e) {
      hasMore = false;
      if (e instanceof IOException) {
        throw TestpressException.networkError((IOException) e);
      } else {
        throw TestpressException.unexpectedError(e);
      }
    }
    hasMore = hasNext() && !emptyPage;
    return hasMore;
  }
 public boolean hasNext() {
   return response == null || response.getNext() != null;
 }