Check if the model class is defined when creating a factory