/**
  * Convert data from array to Data Object representation if type is Data Object or array of Data Objects.
  *
  * @param mixed $value
  * @param string $type Convert given value to the this type
  * @return mixed
  */
 protected function _convertValue($value, $type)
 {
     $isArrayType = $this->_typeProcessor->isArrayType($type);
     if ($isArrayType && isset($value['item'])) {
         $value = $this->_removeSoapItemNode($value);
     }
     if ($this->_typeProcessor->isTypeSimple($type)) {
         $result = $this->_typeProcessor->processSimpleType($value, $type);
     } else {
         /** Complex type or array of complex types */
         if ($isArrayType) {
             // Initializing the result for array type else it will return null for empty array
             $result = is_array($value) ? [] : null;
             $itemType = $this->_typeProcessor->getArrayItemType($type);
             foreach ($value as $key => $item) {
                 $result[$key] = $this->_createFromArray($itemType, $item);
             }
         } else {
             $result = $this->_createFromArray($type, $value);
         }
     }
     return $result;
 }