separate db stuff into model file