create and update model for database