How to avoid Duplicate emails getting processed. Logic to be identified

Hi,

If with same subject line 2 mails are present bot should pick first mail which is recent one
what i should use logic.

Thanks.

Hi @harika_k

recentEmails = (From email In emails
                Group email By Subject = email.Subject Into Group
                Let MostRecentEmail = Group.OrderByDescending(Function(e) e.Date).First()
                Select MostRecentEmail).ToList()

Regards,