add record core function
refactor publisher code