I have created a query that allows group messages based on the reference number and chose each group\'s latest record.
var list = _context.Messages.Include(m