protected function getOrCreateAttachment(File $file, AttachableObjectInterface $object, $fieldName, FileKey $fileKey)
    {
        $attachment = $this->getAttachment($fileKey->getKey());
        
        if (null === $attachment)
        {
            $schema = $this->getSchemaForObject($object, $fieldName);
            
            $attachment = new Attachment();
            $attachment
                ->setFileKey($fileKey->getKey())
                ->setFileSize($file->getSize())
                ->setFileType($file->getMimeType())
                ->setStorageName($schema->getStorage()->getName())
                ->setStorageDepth($schema->getStorageDepth())
                ->setHashType($schema->getHashCallableAsString())
            ;
        }
        
        return $attachment;
    }