Are you able to move the implementation to be very similar to Array * AbstractMessage::attachments()?
It would be mean: moving most of the code to HTMLRenderer.