I'd move this into a separate method, to make the current method more readable.