public function validate($object)
{
$flattenedErros = array();
$errors = $this->validator->validate($object);
if (count($errors) > 0) {
foreach ($errors as $error) {
$flattenedErros[$error->getPropertyPath()] = $error->getMessage();
}
throw new InvalidException("Object is invalid", $flattenedErros);
}
}