Properly compare IDs when checking for entries with the same name