src/Model/Article.php
private function ensureOrder(Model $attachment, string $type): Model
    {
        $attachmentOrder = $attachment->get('order');

        if (empty($attachmentOrder)) {
            $attachment->set(
                'order',
                count($this->getAttachmentByField($type)) + 1
            );
        }

        return $attachment;
    }
private function ensureOrder(Model $attachment, string $type): Model
    {
        $attachmentOrder = $attachment->get('order');

        if (empty($attachmentOrder)) {
            $attachment->set(
                'order',
                count($this->getAttachmentByField($type)) + 1
            );
        }

        return $attachment;
    }
ensuring order