public DataSet bindMessagesIntoDataTable(Guid id)
        {
            //SocialProfilesRepository socioprofrepo = new SocialProfilesRepository();
            //List<SocialProfile> alstprofiles = socioprofrepo.getAllSocialProfilesOfUser(user.Id);

            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
            List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(id);



            // DataTableGenerator datatablegenerepo = new DataTableGenerator();
            Messages mstable = new Messages();
            DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable);
            //  DataSet ds = datatablegenerepo.CreateDataSetForTable(mstable);

            foreach (TeamMemberProfile item in alstprofiles)
            {
                if (item.ProfileType == "facebook")
                {
                    FacebookFeedRepository fbfeedRepo = new FacebookFeedRepository();
                    List<FacebookFeed> alstfeedfb = fbfeedRepo.getUnreadMessages(item.ProfileId);
                    foreach (FacebookFeed facebookmsg in alstfeedfb)
                    {
                        ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus);
                    }
                }
                else if (item.ProfileType == "twitter")
                {
                    TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                    List<TwitterMessage> lstmsgtwtuser = twtmsgrepo.getUnreadMessages(item.ProfileId);
                    foreach (TwitterMessage lst in lstmsgtwtuser)
                    {
                        ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus);
                    }
                }
                else if (item.ProfileType == "googleplus")
                {

                }


            }


            foreach (TeamMemberProfile item in alstprofiles)
            {
                if (item.ProfileType == "facebook")
                {
                    try
                    {
                        //FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository();
                        //List<FacebookFeed> alstfbmsgs = fbfeedrepo.getAllReadFacebookFeeds(user.Id, item.ProfileId);
                        //foreach (FacebookFeed facebookmsg in alstfbmsgs)
                        //{
                        //    ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type,facebookmsg.ReadStatus);
                        //}
                        facebookid += item.ProfileId + ",";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
                else if (item.ProfileType == "twitter")
                {
                    try
                    {
                        //TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                        //List<TwitterMessage> lstmsgtwtuser = twtmsgrepo.getAllReadMessagesOfUser(user.Id, item.ProfileId);
                        //foreach (TwitterMessage lst in lstmsgtwtuser)
                        //{
                        //    ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type,lst.ReadStatus);
                        //}
                        twitterid += item.ProfileId + ",";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
                else if (item.ProfileType == "googleplus")
                {
                    try
                    {
                        //GooglePlusActivitiesRepository objActRepo = new GooglePlusActivitiesRepository();
                        //List<GooglePlusActivities> lstmsggauser = objActRepo.getAllgoogleplusActivityOfUser(user.Id, item.ProfileId);
                        //foreach (GooglePlusActivities lst in lstmsggauser)
                        //{
                        //    ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities");
                        //}
                        googleplusid += item.ProfileId + ",";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

            }
            if (facebookid != "")
            {
                facebookid = facebookid.Substring(0, facebookid.Length - 1);
            }
            if (twitterid != "")
            {
                twitterid = twitterid.Substring(0, twitterid.Length - 1);
            }
            if (googleplusid != "")
            {
                googleplusid = googleplusid.Substring(0, googleplusid.Length - 1);
            }

            FacebookFeedRepository fbfeedRepository = new FacebookFeedRepository();
            List<FacebookFeed> alstfbmsgs = fbfeedRepository.getAllReadFbFeeds(facebookid);
            try
            {
                foreach (FacebookFeed facebookmsg in alstfbmsgs)
                {
                    try
                    {
                        ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }



            TwitterMessageRepository twtmsgRepository = new TwitterMessageRepository();
            List<TwitterMessage> lstmsgtwt = twtmsgRepository.getAlltwtMessagesOfUser(twitterid);
            try
            {
                foreach (TwitterMessage lst in lstmsgtwt)
                {
                    try
                    {
                        ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }



            GooglePlusActivitiesRepository objActRepository = new GooglePlusActivitiesRepository();
            List<GooglePlusActivities> lstmsggpl = objActRepository.getAllgplusOfUser(googleplusid);
            try
            {
                foreach (GooglePlusActivities lst in lstmsggpl)
                {
                    try
                    {
                        ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            return ds;
        }