code: protected function extractFieldsFor(array $fields, $rootField)
      {
          $result = [];
  
          foreach ($fields as $field) {
              if (0 === strpos($field, "{$rootField}.")) {
                  $result[] = preg_replace('/^' . preg_quote($rootField, '/') . '\./i', '', $field);
              }
          }
  
          return array_unique($result);
      }
docs: Extract nested fields from a fields collection for a given root field
  Nested fields are separated with dots (.). e.g: "item.id"
  The previous example would extract "id".
  
  @param array $fields The fields requested for extraction
  @param string $rootField The root field for which we want to extract the nested fields
  @return array nested fields extracted for the given field
  @since 2.0.14