public function validate($value, Constraint $constraint)
    {
        if (!$value) {
            return;
        }

        $fileHistory = $this->em->getRepository('JbFileUploaderBundle:FileHistory')->find($value);
        if (!$fileHistory) {
            return;
        }

        // No userid associated with file. Every one can use it.
        if (!$fileHistory->getUserId()) {
            return;
        }

        // No token. Violation as there is a user id associate with file.
        $token = $this->tokenStorage->getToken();
        if (!$token) {
            return $this->createViolation($value, $constraint);
        }

        // No user. Violation as there is a user id associate with file.
        $user = $token->getUser();
        if (!$user) {
            return $this->createViolation($value, $constraint);
        }

        if ($user->getId() !== $fileHistory->getUserId()) {
            return $this->createViolation($value, $constraint);
        }

        return;
    }