move data manipulation to 'model'