public static synchronized String getNextDraftID(VFS vfs, String speciesID) {
    int nextID = 0;
    VFSPath rootURI;

    try {
      rootURI = VFSUtils.parseVFSPath(ServerPaths.getDraftAssessmentRootURL(speciesID));
    } catch (VFSPathParseException e) {
      e.printStackTrace();
      return null;
    }

    if (vfs.exists(rootURI)) { // If there's already regionals for this guy,
      // get the next
      VFSPathToken[] tokens;
      try {
        tokens = vfs.list(rootURI);
        for (VFSPathToken curToken : tokens) {
          String filename = curToken.toString();
          filename = filename.replaceAll(".xml", "");
          if (!SISContainerApp.amIOnline()) filename = filename.replaceAll("offline", "");

          System.out.println("Crawling file " + curToken + " for new regional ID.");

          try {
            int value = Integer.valueOf(filename.split("_")[1]);
            nextID = Math.max(value, nextID);
          } catch (NumberFormatException e) {
            SysDebugger.getNamedInstance(SISContainerApp.SEVERE_LOG)
                .println(
                    "Annoying file in path "
                        + curToken
                        + " non-conformant "
                        + "to standard region assessment file name pattern.");
          }
        }
      } catch (NotFoundException e) {
        SysDebugger.getNamedInstance(SISContainerApp.SEVERE_LOG)
            .println("Big WTF. " + "List failed on existing path " + rootURI.toString());
        return null;
      }

      nextID++; // Increment it one past the highest found.
    }

    String assessmentID = speciesID + "_" + nextID;
    return assessmentID;
  }
  private void postAssessment(Request request, Response response, String username) {
    try {
      String entity = request.getEntity().getText();

      NativeDocument doc = NativeDocumentFactory.newNativeDocument();
      doc.parse(entity);
      AssessmentParser parser = new AssessmentParser(doc);
      AssessmentData assessment = parser.getAssessment();

      VFSPath assessmentUrl = new VFSPath(ServerPaths.getPathForAssessment(assessment, username));

      if (vfs.exists(assessmentUrl)) {
        Status status =
            FileLocker.impl.persistentLockAssessment(
                assessment.getAssessmentID(),
                BaseAssessment.DRAFT_ASSESSMENT_STATUS,
                LockType.SAVE_LOCK,
                username);

        if (status.isSuccess()) {
          AssessmentIOWriteResult result = saveAssessment(assessment, username);
          if (result.status.isSuccess()) {
            response.setEntity(result.newLastModified + "", MediaType.TEXT_PLAIN);
            response.setStatus(status);
          } else {
            response.setStatus(Status.CLIENT_ERROR_EXPECTATION_FAILED);
          }
        } else {
          response.setStatus(status);
        }
      }
    } catch (RegionConflictException e) {
      response.setStatus(Status.CLIENT_ERROR_CONFLICT);
    } catch (Exception e) {
      e.printStackTrace();
      response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
    }
  }