Hashset contains & distinct using groupby clause