Refactor save method