Handle metadata_type sorting