Rewrite prepare_resources to be more generic in selecing providers