implement database and model class