public function _cleanup(&$collection)
    {
        $name = $this->name();

        if ($this->isMany()) {
            foreach ($collection as $index => $entity) {
                if (is_object($entity)) {
                    $entity->{$name} = [];
                } else {
                    $collection[$index][$name] = [];
                }
            }
            return;
        }

        foreach ($collection as $index => $entity) {
            if (is_object($entity)) {
                unset($entity->{$name});
            } else {
                unset($entity[$name]);
            }
        }
    }