public function unlinkAll($relation, $primary)
    {
        if (is_null($this->schema)) {
            throw SystemException::forNoSchema();
        }

        $name = $this->schema->getName();
        $relations = $this->schema->getRelations();
        $table = $name . '_' . $relation;

        if (!isset($relations[$table])) {
            throw SystemException::forNoRelation($name, $relation);
        }

        $relation = $relations[$table];

        $filter = sprintf('%s = %%s', $relation['primary1']);

        return $this
            ->resource
            ->search($table)
            ->addFilter($filter, $primary)
            ->getCollection()
            ->each(function ($i, $model) use (&$table) {
                $model->remove($table);
            })
            ->get();
    }