restructure resources and sub_resources