private function assertValid($object, int $code = 0)
    {
        $errors = $this->validator->validate($object);
        if (count($errors)) {
            throw ValidationException::becauseOfValidationErrors($errors, $code);
        }
    }