i would go for an if/else

```
if ($class->getFieldValue($document, $uuidFieldName)) {
    if (!UUIDHelper...)
} else {
    $class->setFieldValue...
}