Add database accessor, implement basic relationships