Refactor db module to recorder