[FEATURE] Sort resources by foreign ordering

Fixes #461