abstract db logic from game API endpoints