/**
  * {@inheritdoc}
  */
 public function validate(CustomerInterface $customer)
 {
     $customerData = $this->extensibleDataObjectConverter->toFlatArray($customer, [], '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $customerErrors = $this->validator->validateData($customerData, [], 'customer');
     $validationResults = $this->validationResultsDataFactory->create();
     if ($customerErrors !== true) {
         return $validationResults->setIsValid(false)->setMessages($this->validator->getMessages());
     }
     $oldAddresses = $customer->getAddresses();
     $customerModel = $this->customerFactory->create()->updateData($customer->setAddresses([]));
     $customer->setAddresses($oldAddresses);
     $result = $customerModel->validate();
     if (true !== $result && is_array($result)) {
         return $validationResults->setIsValid(false)->setMessages($result);
     }
     return $validationResults->setIsValid(true)->setMessages([]);
 }
 /**
  * {@inheritdoc}
  */
 public function validateCustomerData(Data\Customer $customer, array $attributes = [])
 {
     $customerErrors = $this->validator->validateData(\Magento\Framework\Service\EavDataObjectConverter::toFlatArray($customer), $attributes, 'customer');
     if ($customerErrors !== true) {
         return $this->customerValidationResultsBuilder->setIsValid(false)->setMessages($this->validator->getMessages())->create();
     }
     $customerModel = $this->converter->createCustomerModel($customer);
     $result = $customerModel->validate();
     if (true !== $result && is_array($result)) {
         return $this->customerValidationResultsBuilder->setIsValid(false)->setMessages($result)->create();
     }
     return $this->customerValidationResultsBuilder->setIsValid(true)->setMessages([])->create();
 }