private fun editPerson(person: Person?) { if (person != null) { prevSelection?.apply { nameProperty().unbindBidirectional(nameField.textProperty()) titleProperty().unbindBidirectional(titleField.textProperty()) } nameField.bind(person.nameProperty()) titleField.bind(person.titleProperty()) prevSelection = person } }