devide IdManager into one for each document and a global one