public void SendGroupNotif(NotifModel notif, List <int> userIds) { string[] gTokens; using (var dataModel = new MibarimEntities()) { var gtokens = dataModel.GoogleTokens.Where(x => userIds.Contains((int)x.GtokenUserId)) .GroupBy(x => x.GtokenUserId, (key, g) => g.OrderByDescending(e => e.GtokenCreateTime).FirstOrDefault()).ToList(); if (gtokens.Count > 0) { _gService.SendGroupNotification(gtokens.Select(x => x.GtokenKey).ToList(), notif.Title, notif.Body, notif.Action, notif.Tab.ToString(), notif.Url); } } }