public int storeBibInfo(
      int batchSize,
      String filePath,
      String fileName,
      BibInfoStatistics bibInfoStatistics,
      int batchNo)
      throws SQLException {

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    int count = 0;
    BibMarcUtil bibMarcUtil = new BibMarcUtil();

    while (bibResultSet.next()) {
      count++;

      int bibId = 0;
      int bibId2 = 0;
      String bibIdStr = "";

      try {

        bibId = bibResultSet.getInt("BIB_ID");
        bibId2 = bibResultSet.getInt("BIB_ID");
        bibIdStr = bibResultSet.getString("UNIQUE_ID_PREFIX") + "-" + bibId;

        if (bibId != bibId2) {
          LOG.error("bibId is not equal to bibId2: bibId = " + bibId + "; bibId2 = " + bibId2);
        }

        BibMarcRecords bibMarcRecords =
            bibMarcRecordProcessor.fromXML(bibResultSet.getString("CONTENT"));

        if (bibMarcRecords != null
            && bibMarcRecords.getRecords() != null
            && bibMarcRecords.getRecords().size() > 0) {

          Map<String, String> dataFields =
              bibMarcUtil.buildDataValuesForBibInfo(bibMarcRecords.getRecords().get(0));
          String title = dataFields.get(BibMarcUtil.TITLE_DISPLAY);
          String author = dataFields.get(BibMarcUtil.AUTHOR_DISPLAY);
          String publisher = dataFields.get(BibMarcUtil.PUBLISHER_DISPLAY);
          String isbn = dataFields.get(BibMarcUtil.ISBN_DISPLAY);
          String issn = dataFields.get(BibMarcUtil.ISSN_DISPLAY);

          String commonIdentifier = "";
          if (StringUtils.isNotEmpty(isbn)) {
            commonIdentifier = isbn;
          } else {
            commonIdentifier = issn;
          }

          bibInsertPreparedStatement.setInt(1, bibId);
          bibInsertPreparedStatement.setString(2, bibIdStr);
          bibInsertPreparedStatement.setString(3, truncateData(title, 4000));
          bibInsertPreparedStatement.setString(4, truncateData(author, 4000));
          bibInsertPreparedStatement.setString(5, truncateData(publisher, 4000));
          bibInsertPreparedStatement.setString(6, truncateData(commonIdentifier, 100));

          try {
            bibInsertPreparedStatement.executeUpdate();
          } catch (Exception e) {
            if (e.getMessage().startsWith("Duplicate entry")) {

              bibUpdatePreparedStatement.setString(1, truncateData(title, 4000));
              bibUpdatePreparedStatement.setString(2, truncateData(author, 4000));
              bibUpdatePreparedStatement.setString(3, truncateData(publisher, 4000));
              bibUpdatePreparedStatement.setString(4, truncateData(commonIdentifier, 100));
              bibUpdatePreparedStatement.setString(5, bibIdStr);
              bibUpdatePreparedStatement.setInt(6, bibId);
              try {
                bibUpdatePreparedStatement.executeUpdate();
              } catch (Exception e1) {
                LOG.error(
                    "Exception while updating into BIB_INFO_T, BibId = "
                        + bibId
                        + " BibIdStr = "
                        + bibIdStr
                        + " : ",
                    e1);
                writeStatusToFile(
                    filePath,
                    fileName,
                    "Exception while updating into BIB_INFO_T, BibId = "
                        + bibId
                        + " BibIdStr = "
                        + bibIdStr
                        + " : "
                        + e1.getMessage());
              }
            } else {
              LOG.error(
                  "Exception while inserting into BIB_INFO_T, BibId = "
                      + bibId
                      + " BibIdStr = "
                      + bibIdStr
                      + " : ",
                  e);
              writeStatusToFile(
                  filePath,
                  fileName,
                  "Exception while inserting into BIB_INFO_T, BibId = "
                      + bibId
                      + " BibIdStr = "
                      + bibIdStr
                      + " : "
                      + e.getMessage());
            }
          }
        }

      } catch (Exception e) {
        LOG.error(
            "Exception inserting/updating bibId "
                + bibId
                + "; bibId2 = "
                + bibId2
                + " BibIdStr = "
                + bibIdStr,
            e);
        writeStatusToFile(
            filePath,
            fileName,
            "Exception inserting/updating bibId "
                + bibId
                + "; bibId2 = "
                + bibId2
                + " BibIdStr = "
                + bibIdStr
                + "\t"
                + e.getMessage());
      }
      bibInfoStatistics.setBibCount((batchSize * batchNo) + count);
      if (count == batchSize) {
        break;
      }
    }
    stopWatch.stop();
    connection.commit();
    return count;
  }