public function deleteContentTypeGroup(APIContentTypeGroup $contentTypeGroup) { if ($this->repository->hasAccess('class', 'delete') !== true) { throw new UnauthorizedException('ContentType', 'delete'); } $loadedContentTypeGroup = $this->loadContentTypeGroup($contentTypeGroup->id); $this->repository->beginTransaction(); try { $this->contentTypeHandler->deleteGroup($loadedContentTypeGroup->id); $this->repository->commit(); } catch (APIBadStateException $e) { $this->repository->rollback(); throw new InvalidArgumentException('$contentTypeGroup', 'Content type group has content type instances', $e); } catch (Exception $e) { $this->repository->rollback(); throw $e; } }