Refactor _savePref()