Recommended use of MidiMessageSequence in the audio render callback

I have created a sequence of midi messages, I was using my own container but then noticed the MidiMessageSequence class and noticed it’s an easy way of also creating a midi file, something which I also need to do. Before now I would add the messages to a vector, check the size of the vector, then gradually move them into the MidiBuffer reference in the callback whilst popping them off and leaving an empty MidiMessage list.

I don’t want to manipulate the MidiMessageSequence object in the callback, should I just sense when I’ve passed the very last message then delete the object or is there a better way?