private void recursiveDeleteDatasetVersions(RestRequest restRequest,
        List<DatasetVersionRecord> datasetVersionRecordList, int idx, Callback<Void> processResponseCallback)
        throws Exception {
      if (idx == datasetVersionRecordList.size()) {
        LOGGER.debug("Complete recursive callback for " + idx + " number of dataset version");
        processResponseCallback.onCompletion(null, null);
        return;
      }
      Dataset dataset = (Dataset) restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_DATASET);
      reconstructRestRequest(restRequest, datasetVersionRecordList.get(idx), dataset.getAccountName(),
          dataset.getContainerName());
      //for delete out of retention request, we don't want to set anything to response channel.
      deleteBlobHandler.handle(restRequest, new NoOpResponseChannel(), (r, e) -> {
        if (e != null) {
          frontendMetrics.deleteDatasetVersionOutOfRetentionError.inc();
          LOGGER.error(
              "Failed to delete dataset version due to " + getRequestPath(restRequest) + " failed with exception" + e);
        }
        try {
          recursiveDeleteDatasetVersions(restRequest, datasetVersionRecordList, idx + 1, processResponseCallback);
        } catch (Exception exc) {
          frontendMetrics.deleteDatasetVersionOutOfRetentionError.inc();
          LOGGER.error(
              "Failed to delete dataset version" + getRequestPath(restRequest) + " failed with exception" + exc);
          processResponseCallback.onCompletion(null, null);
        }
      });
    }
Recursively delete the dataset version out of retention count at dataset level.
@param datasetVersionRecordList the list of the {@link DatasetVersionRecord}
@param idx the index of the datasetVersionRecordList
@param restRequest the {@link RestRequest}
@param processResponseCallback the call back to process response.
ambry-frontend/src/main/java/com/github/ambry/frontend/NamedBlobPutHandler.java