private function deriveDtoAndEntityFqnFromCollection(Collection $collection): array
    {
        if (0 === $collection->count()) {
            throw new \RuntimeException('Collection is empty');
        }
        $dtoFqn              = null;
        $collectionEntityFqn = null;
        foreach ($collection as $dto) {
            if ($dto instanceof EntityInterface) {
                $collectionEntityFqn = \get_class($dto);
                continue;
            }
            if (false === ($dto instanceof DataTransferObjectInterface)) {
                throw new \InvalidArgumentException(
                    'Found none DTO item in collection, was instance of ' . \get_class($dto)
                );
            }
            if (null === $dtoFqn) {
                $dtoFqn = \get_class($dto);
                continue;
            }
            if (false === ($dto instanceof $dtoFqn)) {
                throw new \InvalidArgumentException(
                    'Mismatched collection, expecting dtoFqn ' .
                    $dtoFqn .
                    ' but found ' .
                    \get_class($dto)
                );
            }
        }
        if (null === $dtoFqn && null === $collectionEntityFqn) {
            throw new \RuntimeException('Failed deriving either the DTO or Entity FQN from the collection');
        }
        if (null === $collectionEntityFqn) {
            $collectionEntityFqn = $this->namespaceHelper->getEntityFqnFromEntityDtoFqn($dtoFqn);
        }
        if (null === $dtoFqn) {
            $dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($collectionEntityFqn);
        }

        return [$dtoFqn, $collectionEntityFqn];
    }