docs: private synchronized void rewriteFile() throws FileNotFoundException, IOException {
          JsonArrayBuilder jsonToStore = Json.createArrayBuilder();
  
          // Iterate through the assets in id order
          Map<String, JsonObject> assetMap = assets == null ? Collections.<String, JsonObject> emptyMap() : assets;
          for (int i = 1; i < idCounter.get(); i++) {
              JsonObject json = assetMap.get(Integer.toString(i));
              if (json == null) {
                  jsonToStore.addNull();
              } else {
                  jsonToStore.add(json);
              }
          }
          // Write the assets back to the file
          Map<String, Object> config = new HashMap<String, Object>();
          config.put(JsonGenerator.PRETTY_PRINTING, true);
          JsonWriterFactory writerFactory = Json.createWriterFactory(config);
          try (FileOutputStream out = new FileOutputStream(file);
                          JsonWriter streamWriter = writerFactory.createWriter(out)) {
              streamWriter.write(jsonToStore.build());
          }
      }