public function parseType(Object\TypeObjectInterface $type, $data)
    {
        if($type instanceof Object\ReferentialInterface && $type->hasRef()) {
            $objectType = $type->getRef();
            $type = $this->resolveReference($type);
        } else {
            try {
                $objectType = $type->getType();
            } catch(SwaggerException\MissingDocumentPropertyException $e) {
                $objectType = null;
            }
        }
        
        if($objectType == 'array') {
            $schemaObject = [];
            
            $arrayItemType = $type->getItems();
            
            foreach($data as $key => $value) {
                $schemaObject[$key] = $this->parseType($arrayItemType, $value);
            }
        } elseif($type instanceof Object\Schema) {
            $schemaObject = new SchemaObject($objectType);
        
            foreach(array_keys(get_object_vars($data)) as $propertyKey) {
                try {
                    $propertySchema = $this->findSchemaForProperty($type, $propertyKey);
                } catch(SwaggerException\MissingDocumentPropertyException $e) {
                    throw (new SwaggerException\UndefinedPropertySchemaException)
                        ->setPropertyName($name)
                        ->setSchema($type);
                }
            
                $propertyValue = $this->parseType(
                    $propertySchema,
                    $data->$propertyKey
                );
                
                $schemaObject->setProperty($propertyKey, $propertyValue);
            }
        } else {
            $schemaObject = $data;
        }
        
        return $schemaObject;
    }