Please to be pulling this logic out into a separate method