public function findByPid(int $pid, int $limit = 0, array $querySettings = ['respectSysLanguage' => true]) {
    if ($pid && $pid > 0) {
      // Create a new query.
      $query = $this->createquery();

      // Apply the passed query settings.
      $query = $this->applyQuerySettings($query, $querySettings);

      // Set the query constraints.
      $query->matching($query->equals('pid', $pid));

      // Set the query limit if available.
      if ($limit > 0) {
        $query->setLimit($limit);
      }

      // Execute the query.
      $result = $query->execute();

      return $result;
    }

    return null;
  }