public function renameFile(File $file, $fileName)
	{
		$entityManager = $this->getDoctrineEntityManager();

		$originFile = clone($file);
		$entityManager->detach($originFile);

		try {
			
			$file->setFileName($fileName);
			
		} catch (\Exception $e) {
			
			throw new Exception\UploadFilterException(self::VALIDATION_EXTENSION_RENAME_MESSAGE_KEY);
		}

		$this->validateFileUpload($file);

		// rename is wrapped into transaction so if something will fail in rename()
		// entity changes will be rolled back
		$entityManager->beginTransaction();
		
		try { 
			// flush will trigger path generator and path transformers
			$entityManager->flush($file);
			
			$this->renameFileInFileSystem($originFile, $file);
			
		} catch (\Exception $e) {	
			$entityManager->rollback();
			throw $e;
		}
		
		$entityManager->commit();
	}