public int GetUnreadMyPrivateTalksCount(string thisMember)
        {
            var context2      = new XYZToDo.Models.DatabasePersistanceLayer.XYZToDoSQLDbContext();
            int unreadPTCount = PrivateTalks.Where(bt => bt.Sender == thisMember).Where(pt => this.NoOfMessagesUnreadHelper(pt.PrivateTalkId, thisMember, context2) == 1).Count();// my private talks that have unread messages inside.

            context2.Dispose();
            return(unreadPTCount);
        }
        public int GetUnreadReceivedPrivateTalksCount(string thisMember)
        {
            var context2 = new XYZToDo.Models.DatabasePersistanceLayer.XYZToDoSQLDbContext();

            PrivateTalk[] ptrs = PrivateTalkReceivers.Where(ptr => ptr.Receiver == thisMember).Select(ptr => ptr.PrivateTalk).ToArray();

            PrivateTalk[] ptrs2 = context.TeamMember.Where(tm => tm.Username == thisMember && tm.Status == true).SelectMany(tm => tm.Team.PrivateTalkTeamReceiver).Select(rec => rec.PrivateTalk).Where(pt => pt.Sender != thisMember).ToArray(); //İçinde bulunduğum takımların, takım alıcıları. 2 takımında bulunuyorum, private talk id 2, 3 takımında bulunuyoorum private talk 5, buradan private talkları getirelim.

            int unreadPTCount = ptrs.Concat(ptrs2)?.GroupBy(pt => pt.PrivateTalkId).Select(x => x.First()).Where(pt => this.NoOfMessagesUnreadHelper(pt.PrivateTalkId, thisMember, context2) == 1)?.Count() ?? 0;

            context2.Dispose();
            return(unreadPTCount);
        }
        public PrivateTalkTeamReceiver[] GetMyPrivateTalkTeamReceivers(string sender, int pageNo, string searchValue, int pageSize = 50) // Returns null or objects,  giden kutusu
        {
            var context2 = new XYZToDo.Models.DatabasePersistanceLayer.XYZToDoSQLDbContext();

            // int pageSize = 12;
            PrivateTalkTeamReceiver[] ptr = null;
            try
            {
                ptr = PrivateTalks.Where(bt => bt.Sender == sender)
                      .OrderByDescending(pt => pt.DateTimeCreated).
                      Where(bt => searchValue == "undefined" || (bt.Thread.Contains(searchValue) || bt.Sender.Contains(searchValue))).Skip((pageNo - 1) * pageSize).Take(pageSize).SelectMany(pt => pt.PrivateTalkTeamReceiver).ToArray();

                context2.Dispose();
            }
            catch (System.Exception)
            {
            }
            return(ptr);
        }