Modify repository to use database