protected function retractRoles($roleIds, $authorityClass, $authorityIds)
    {
        $query = $this->newPivotTableQuery();

        $morphType = (new $authorityClass)->getMorphClass();

        foreach ($roleIds as $roleId) {
            foreach ($authorityIds as $authorityId) {
                $query->orWhere($this->getDetachQueryConstraint(
                    $roleId, $authorityId, $morphType
                ));
            }
        }

        $query->delete();
    }