public function getMentionsFromRelatedEntity($entity) {
    if ($entity->getEntityTypeId() === 'comment') {
      if ($entity->getParentComment()) {
        $entity = $entity->getParentComment();
      }
    }
    // Mention entity can't be loaded at time of new post or comment creation.
    $mentions = \Drupal::entityTypeManager()
      ->getStorage('mentions')
      ->loadByProperties([
        'entity_type' => $entity->getEntityTypeId(),
        'entity_id' => $entity->id(),
      ]);
    return $mentions;
  }