protected function clampPosition()
    {
        if (!$this->isDirty($this->getPositionColumn())) {
            return;
        }
        $newPosition = max(0, min($this->position, $this->getNextAfterLastPosition()));
        $this->attributes[$this->getPositionColumn()] = $newPosition;
    }