Ordering entities by multiple metadata elements and listing in groups

Hi.  I'm working on a plugin modeled after the bookmarks plugin.  However, I want to list the entities in order of 3 metadata elements then have the listing shown with subtitles. Specifically I have CountryCity and Event_Date as metadata for my entities and I want the listing to show them as follows:

Australia

  Melbourne

     Listing 1 March 10 2015

     Listing 2 April 9 2015

     ....

  Sydney

     Listing x March 23 2015

Canada

   Toronto

      Listing y June 1 2015

.....

 

So it first groups them by Country, then City then order by date (only those in the future).

I've been playing with elgg_list_entities_from_metadata() and using the order_by_metadata but can't get it to work the way I want.  Right now I have multiple listings coming up for each entity.  Am I going about this the right way?  Some direction would be greatly appreciated.  Or if there is a plugin that I can use as reference that would also be great.

I have this feeling I will need to break it down more to be able to insert the grouping titles...

Thanks