//------------------------------
	void SceneGraphWriter::writeInstanceNodes( const COLLADAFW::InstanceNodePointerArray& instanceNodes)
	{
		for ( size_t i = 0, count = instanceNodes.getCount(); i < count; ++i)
		{
			const COLLADAFW::InstanceNode* instanceNode = instanceNodes[i];
			const COLLADAFW::UniqueId& referencedNodeUniqueId = instanceNode->getInstanciatedObjectId();
			UniqueIdNodeMap::const_iterator it = mUniqueIdNodeMap.find( referencedNodeUniqueId );
			if ( it != mUniqueIdNodeMap.end() )
			{
				const COLLADAFW::Node* referencedNode = it->second;
				writeNode( referencedNode );
			}
		}
	}
	//------------------------------
	bool SceneGraphCreator::importInstanceNodes( const COLLADAFW::InstanceNodePointerArray& instanceNodeArray, ImpNode* parentImportNode )
	{
		for ( size_t i = 0, count = instanceNodeArray.getCount(); i < count; ++i)
		{
			COLLADAFW::InstanceNode* instanceNode = instanceNodeArray[i];

			const COLLADAFW::UniqueId& uniqueId = instanceNode->getInstanciatedObjectId();

			INode* instanciatedINode = getINodeByUniqueId(uniqueId);
			// check if the referenced node is already in the max scene graph
			if ( instanciatedINode )
			{
				if ( !recursivelyCloneINode(parentImportNode, instanciatedINode) )
					return false;;
			}
			else
			{
				const COLLADAFW::Node* instanciatedFWNode = getFWNodeByUniqueId( uniqueId );
				// check if the referenced node is in one of the already received library nodes
				if ( instanciatedFWNode )
				{
					importNode( instanciatedFWNode, parentImportNode->GetINode() );
				}
#if 0
				else
				{
					// If the referenced node has not been imported, store which node is referenced
					// to clone the nodes as the referenced nodes gets imported
					addUniqueIdReferencingImpNodePair(instanceNode->getInstanciatedObjectId(), parentImportNode );
				}
#endif
			}
		}

		return true;
	}