Properly save modified objects in Prefs