order attributes with primary first

order attributes with primary first