object ModelConfigurationStore { val modelConfigurations = mutableListOf().observable() fun save(path: String) = modelConfigurations .toJSON() .save(Paths.get(path), CREATE, TRUNCATE_EXISTING) fun load(path: String) { val file = Paths.get(path) if (Files.exists(file)) { modelConfigurations.setAll(loadJsonArray(file, READ).toModel()) } else { modelConfigurations.clear() } } }