added build function to fold over a list of LogMessage's to build a MessageTree