Better refactor of save method