refactor code from dialogue worker to move to schedule and history managers