Added option for sorting metadata elements according to the order defined in metadata settings