Sort api responses. Links, then id/attributes and inner links