protected function getStubEntity($entity_type, array $values) {
    $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->create($values);
    if (!$entity instanceof ContentEntityInterface) {
      throw new EntityMalformedException("Only content entities are supported.");
    }
    return $entity;
  }