Refactored save action