Task #2797 cdb Core refactor

@pamval please review