public function setPosition(Model $model, $position)
    {
        if ($position === $model->getListifyPosition()) {
            return $position;
        }

        switch ($position) {

            case null:
            case OrderablePosition::REMOVE:
                $model->removeFromList();
                break;

            case OrderablePosition::UP:
                $model->moveHigher();
                break;

            case OrderablePosition::DOWN:
                $model->moveLower();
                break;

            case OrderablePosition::TOP:
                if ($model->isInList()) {
                    $model->moveToTop();
                } else {
                    $model->insertAt();
                }
                break;

            case OrderablePosition::BOTTOM:
                if ($model->isInList()) {
                    $model->moveToBottom();
                } else {
                    $model->insertAt();
                    $model->moveToBottom();
                }
                break;

            default:
                $position = (int) $position;

                $model->insertAt($position);
        }

        return $model->getListifyPosition();
    }