public function onPreSubmit(FormEvent $event)
    {
        $data = $event->getData();

        if ($data['file'] instanceof UploadedFile) {
            $event->getForm()->remove('remove');
        }

        if (empty($data['file']) && (!isset($data['remove']) || !$data['remove'])) {
            $event->setData($event->getForm()->getViewData());
        }
    }