Adding a more generic resource setting logic.