adapted the controller to support nested resources