@Srokap I copied this from elgg_list_entities()