Factoring out common parts of UserDatabase and MessageDatabase, which is *for now* basically everything. msg_id -> UID.