I'd make a collection of collections, sorting each record into a sorted list based on the UID.  You could use the UID as a hash to lookup the collection for the records.