Move push/pop of the current task into a method