- if ($entityType == 'chapter') {
- $parent = $this->chapterRepo->getById($entityId);
- } else if ($entityType == 'book') {
- $parent = $this->bookRepo->getById($entityId);
- }
-
- if ($parent === false || $parent === null) {
+ try {
+ $parent = $this->entityRepo->getById($entityType, $entityId);
+ } catch (\Exception $e) {