public void ToggleLikePostByID(int id,int userid)
        {
            Models.ComboResponse _response = new Models.ComboResponse();
            _response.bool_result = true;
            _response.ErrorCode = 0;
            _response.ErrorMsg = "";

            ComboPostAttachment att = new ComboPostAttachment();
            att.GetPostAttachmentsByPostID(id);

            ComboPostLike likes = new ComboPostLike();
            if (!likes.LoadByPrimaryKey(userid, id))
            {
                likes.AddNew();
                likes.ComboPostID = id;
                likes.ComboUserID = userid;
                likes.Save();

                // save notification and push it to device
                ComboPost post = new ComboPost();
                post.LoadByPrimaryKey(id);
                ComboUser creator = new ComboUser();
                ComboUser liker = new ComboUser();
                creator.LoadByPrimaryKey(post.ComboUserID);
                liker.GetUserByUserId(userid);
                if (creator.ComboUserID != liker.ComboUserID)
                {
                    List<Models.ComboPostLike> alike = likes.DefaultView.Table.AsEnumerable().Select(row =>
                        {
                            return new Models.ComboPostLike
                            {
                                ComboPostID = Convert.ToInt32(row["ComboPostID"]),
                                ComboUserID = Convert.ToInt32(row["ComboUserID"]),
                                UserName = liker.UserName,
                                DisplayName = liker.DisplayName,
                                PostText = post.PostText,
                                ProfilePic = liker.GetColumn("ProfilePic").ToString(),
                                Attachments = att.DefaultView.Table.AsEnumerable().Select(r =>
                                {
                                    return new Models.Attachment
                                    {
                                        AttachmentID = Convert.ToInt32(r["AttachmentID"]),
                                        Path = r["Path"].ToString(),
                                        AttachmentTypeID = Convert.ToInt32(r["AttachmentTypeID"]),
                                        ThumbsPath = r["ThumbsPath"].ToString()
                                    };
                                }).ToList(),
                            };
                        }).ToList();

                    ComboNotification notification = new ComboNotification();
                    notification.AddNew();
                    notification.ComboUserID = post.ComboUserID;
                    notification.NotificationType = (int)Combo.Models.NotificationType.LIKE; // like
                    notification.NotificationDate = DateTime.UtcNow;
                    notification.NotificationBody = Newtonsoft.Json.JsonConvert.SerializeObject(alike);
                    notification.IsRead = false;
                    notification.Save();

                    NotificationUserSettings settings = new NotificationUserSettings();
                    settings.LoadByPrimaryKey(creator.ComboUserID, (int)Combo.Models.NotificationType.LIKE);
                    bool notify = false;
                    if (settings.RowCount == 0)
                        notify = true;
                    else
                        notify = settings.CanGetNotification(creator.ComboUserID, liker.ComboUserID, (int)Combo.Models.NotificationType.LIKE);
                    if (notify)
                    {
                        List<Models.ComboNotification> notificationJson = notification.DefaultView.Table.AsEnumerable().Select(row =>
                            {
                                return new Models.ComboNotification
                                {
                                    ComboNotificationID = Convert.ToInt32(row["ComboNotificationID"]),
                                    ComboUserID = Convert.ToInt32(row["ComboUserID"]),
                                    IsRead = Convert.ToBoolean(row["IsRead"]),
                                    NotificationBody = row["NotificationBody"].ToString(),
                                    NotificationDate = Convert.ToDateTime(row["NotificationDate"].ToString()).Subtract(new DateTime(1970, 1, 1)).TotalSeconds,
                                    NotificationType = Convert.ToInt32(row["NotificationType"])
                                };
                            }
                            ).ToList();

                        string notification_response = SendGCMNotification(Newtonsoft.Json.JsonConvert.SerializeObject(notificationJson), creator.DeviceID);
                    }
                }
            }
            else
            {
                likes.MarkAsDeleted();
                likes.Save();
            }

            likes.GetPostLikesByPostID(id);

            List<Models.ComboPostLike> Alllikes = likes.DefaultView.Table.AsEnumerable().Select(row =>
            {
                return new Models.ComboPostLike
                {
                    ComboPostID = Convert.ToInt32(row["ComboPostID"]),
                    ComboUserID = Convert.ToInt32(row["ComboUserID"]),
                    UserName = row["UserName"].ToString(),
                    DisplayName = row["DisplayName"].ToString(),
                };
            }).ToList();

            _response.Entity = Alllikes;
            SetContentResult(_response);
        }