protected function throwsExceptionIfEntityNotFound($entityName, $id)
    {
        if (null === $entity = $this->getRepository($entityName)->find($id)) {
            throw new \InvalidArgumentException(sprintf('Cannot find `%s` with id `%s`.', $entityName, $id));
        }

        return $entity;
    }