public Persistent SaveObject(Persistent obj) throws IllegalAccessException
    {
        NodeReference node = null;
        try
        {
            String globalName = obj.GetStorageGlobalName();
            node = connection.createNodeReference(globalName);
        }
        catch (Exception ex)
        {
            log.WriteToFile(ex.toString(), true);
            throw ex;
        }
        
        Persistent oldObj = null;
        if (obj.Id == 0)
        {
        	node.increment(1);
            
        	obj.Id = node.getLong();
        }
        else
        {
        	oldObj = LoadObjectById(obj.Id, obj);
        	//node.setSubscriptCount(0);
        	//znode .setSubscriptCount((int)obj.Id);
            //node.appendSubscript(obj.Id);
        }
        
        Class info = obj.getClass();
        Field[] fields = info.getFields();
        Field field;

        for (int i = 0; i < fields.length; i++)
        { 
        	field = fields[i];
            FieldSetter.SetFieldValue(obj, field, node);
            //SetNodeSubscriptField(field, obj, node);
            UpdateIndexForField(obj, field, oldObj);
        }
        return obj;
    }