refactored code to use resources in fruits controller