Refactored functional for add/remove favorite item