update model and database