companies and items and pivot table company_item. Pivot table has a boolean obsolete field. item_id but different pivot_id, the toggle will work on first ocurrence because is taking item_id and should take pivot_id for this.pivot_id (2809 and 5895) is taking the item_id.