I've used a grouped linq query on the controller, but this approach is much easier to read and understand.
StackOverflow Link
Required Field