public function validate(AbstractData $data, $expectedVersion)
    {
        $validator = new Validator();
        $validator->addValidator('unique', new UniqueValidator());
        $validator->addValidator('reference', new ReferenceValidator());
        $validator->addValidator('many', new ManyValidator());
        $rules      = $this->buildUpRules($data, $validator);
        $toValidate = $this->buildUpData();
        if ($this->definition->hasOptimisticLocking()) {
            $rules['version']      = [['value', $expectedVersion]];
            $toValidate['version'] = $this->entity->get('version');
        }
        $validation = $validator->isValid($rules, $toValidate);
        return $validation;
    }