transactions->run(function () use ($name): int { if ($this->groups->isNameTaken($name->value)) { throw new StockNameTaken; } return (int) $this->groups->save(StockItemGroup::create($name, $this->groups->nextSortOrder()))->id(); }); } }