Fixing bug when multiple files are associated with the same entity

Avoiding to handle the same entity multiple times