protected function performOnFiles(Entity $entity, $entityName, $function)
    {
        $fields = $this->entityDefinition->getEditableFieldNames();
        foreach ($fields as $field) {
            if ($this->entityDefinition->getType($field) == 'file') {
                $function($entity, $entityName, $field);
            }
        }
    }