Put resource inside if