refactoring save