/**
  * @param DocumentInterface $document
  * @param mixed             $value
  *
  * @return void
  */
 public function onDocumentFill(DocumentInterface $document, $value)
 {
     $value = is_null($value) ? $document->getOriginal($this->key) : $value;
     parent::onDocumentFill($document, $value);
     if ($value instanceof UploadedFile and !empty($this->getSelectedSameImageFields())) {
         $fields = $this->getSection()->getFields();
         foreach ($this->getSelectedSameImageFields() as $sameField) {
             if ($fields->offsetExists($sameField) and !is_null($field = $fields->offsetGet($sameField)) and !$document->{$sameField} instanceof UploadedFile) {
                 if ($filePath = $field->copyImageFile($document->{$this->getDBKey()})) {
                     $document->{$sameField} = $filePath;
                 }
             }
         }
     }
 }