26566 maximize attachment sharing between revisions of a document

This fixes a problem when multiple copies of the same attachment get created in case of two documents having the same attachment content. 
D is another not good variable name. Perhaps GlobalProcessed or something to indicate its all attachments in the entire database?