How to structure a large template event function

I’ve got a large template event function that are many pages long.
I would like to restructure it with sub-functions as one normally does in C++, Java, etc.
How can I do that?