protected function getFromDataMapper(string $functionName, array $args = [])
    {
        $entities = $this->dataMapper->$functionName(...$args);

        if (is_array($entities)) {
            // Passing by reference here is important because that reference may be updated in the unit of work
            foreach ($entities as &$entity) {
                if ($entity !== null) {
                    $this->unitOfWork->getEntityRegistry()->registerEntity($entity);
                }
            }
        } elseif ($entities !== null) {
            $this->unitOfWork->getEntityRegistry()->registerEntity($entities);
        }

        return $entities;
    }