public function getProfile(UserInterface $entity) {
    $user_profile = NULL;

    /** @var \Drupal\profile\ProfileStorageInterface $storage */
    try {
      $storage = $this->entityTypeManager->getStorage('profile');
      if (!empty($storage)) {
        $user_profile = $storage->loadByUser($entity, 'profile', TRUE);

        // TODO: Remove once #3005113 is fixed in the profile module.
        if ($user_profile === FALSE) {
          $user_profile = NULL;
        }
      }
    }
    catch (\Exception $e) {
    }
    return $user_profile;
  }