sort a list of ObjectIDs or objects based on an array of ObjectIDs