Move save functionality to model layer