/**
  * @param DocumentInterface     $document
  * @param SectionInterface|null $relatedSection
  * @param FieldInterface|null   $relatedField
  *
  * @return HasManyRelation
  */
 public function getDocumentRelation(DocumentInterface $document, SectionInterface $relatedSection = null, FieldInterface $relatedField = null)
 {
     $instance = $relatedSection->getEmptyDocument()->newQuery();
     $foreignKey = $this->getRelatedField()->getDBKey();
     $localKey = $relatedSection->getDocumentPrimaryKey();
     return new HasManyRelation($instance, $document, $foreignKey, $localKey);
 }