private BibTrees fetchResultSet(int batchSize, BatchStatistics batchStatistics, Boolean isBibOnly)
      throws Exception {
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    BibTrees bibTrees = new BibTrees();
    int count = 0;
    if (batchSize <= 0) {
      return bibTrees;
    }
    while (bibResultSet.next()) {
      count++;
      BibTree bibTree = new BibTree();
      Bib bib = fetchBibRecord();
      bibTree.setBib(bib);
      if (!isBibOnly) {
        List<HoldingsTree> holdingsList =
            fetchHoldingsTreeForBib(Integer.parseInt(bib.getLocalId()));
        bibTree.getHoldingsTrees().addAll(holdingsList);
        batchStatistics.addHoldingsCount(holdingsList.size());

        for (HoldingsTree holdingsTree : holdingsList) {
          batchStatistics.addItemCount(holdingsTree.getItems().size());
        }
      }

      bibTrees.getBibTrees().add(bibTree);
      if (count == batchSize) {
        break;
      }
    }
    stopWatch.stop();
    batchStatistics.addTimeTaken(stopWatch.getTotalTimeMillis());
    batchStatistics.addBibCount(bibTrees.getBibTrees().size());
    return bibTrees;
  }
 private Bib fetchBibRecord() throws SQLException {
   Bib bib = new BibMarc();
   bib.setCreatedBy(bibResultSet.getString("CREATED_BY"));
   bib.setCreatedOn(bibResultSet.getString("DATE_CREATED"));
   if (bibResultSet.getString("STAFF_ONLY") != null) {
     bib.setStaffOnly(
         (bibResultSet.getString("STAFF_ONLY").equalsIgnoreCase("Y")
             ? Boolean.TRUE
             : Boolean.FALSE));
   }
   bib.setContent(bibResultSet.getString("CONTENT"));
   bib.setUpdatedBy(bibResultSet.getString("UPDATED_BY"));
   bib.setUpdatedOn(bibResultSet.getString("DATE_UPDATED"));
   bib.setStatus(bibResultSet.getString("STATUS"));
   bib.setStatusUpdatedBy(bibResultSet.getString("STATUS_UPDATED_BY"));
   bib.setStatusUpdatedOn(bibResultSet.getString("STATUS_UPDATED_DATE"));
   bib.setLastUpdated(bibResultSet.getString("DATE_UPDATED"));
   String uuid = bibResultSet.getString("UNIQUE_ID_PREFIX") + "-" + bibResultSet.getString(1);
   bib.setId(uuid);
   bib.setLocalId(bibResultSet.getString(1));
   return bib;
 }