refactor core models, extract task and event entity