// First add this entity to any list found on the entity stack.
for(int i=0; i< state.edepth(); i++){
// Look for all Array Lists on the Entity Stack that look like lists of this Entity
IREntity entity = state.getes(i);
IRObject elist = entity.get(listname);
if(elist!=null && elist.type().getId()==IRObject.iArray){
// If not a member of this list, then add it.
if(!((RArray)elist).contains(e)){
((RArray)elist).add(e);
}
}