refactored favorites controller to handle any model