updated controller to use resource