Move context persist into the task process