As those 3 lines repeat themselves in many task it might make sense to factor them out in a helper.