Move the data manipulation to model class