Finished functions to write game stats from range of ids to db.