OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            switch (originalChat[position].IsGroup)
            {
            case false:
                ChatAdaptereViewHolder vh = holder as ChatAdaptereViewHolder;
                var ContactUser           = ContactRepository.GetContactbyUserId(Convert.ToInt64(originalChat[position].ContactId));
                if (ContactUser != null)
                {
                    vh.SenderName.Text = ContactUser.name;
                    if (Convert.ToDateTime(originalChat[position].LastMessageDate).ToLocalTime().Date == DateTime.UtcNow.ToLocalTime().Date)
                    {
                        vh.MsgTextTime.Text = Convert.ToDateTime(originalChat[position].LastMessageDate).ToLocalTime().ToString("hh:mm tt");
                    }
                    else
                    {
                        vh.MsgTextTime.Text = Convert.ToDateTime(originalChat[position].LastMessageDate).ToLocalTime().Date.ToString("MM/dd/yyyy");
                    }
                    vh.txtFeedMessage.Text = originalChat[position].LastMessage;

                    int count = ChatMessageRepository.getChatMessageUnRead(originalChat[position].ChatId);

                    if (count > 0)
                    {
                        vh.MsgTextTime.SetTextColor(Color.YellowGreen);
                        vh.txtMessageCount.Visibility = ViewStates.Visible;
                        vh.txtMessageCount.Text       = count.ToString();
                    }
                    else
                    {
                        vh.txtMessageCount.Visibility = ViewStates.Invisible;
                    }

                    if (!string.IsNullOrEmpty(ContactUser.contactPicUrl))
                    {
                        Picasso.With(context)
                        .Load(ContactUser.contactPicUrl)
                        .Transform(new CircleTransformation())
                        .Fit()
                        .Into(vh.imgMessagelogo);
                    }
                }
                break;

            case true:
                ChatGroupViewHolder viewHolder = holder as ChatGroupViewHolder;

                int countGroupUnread = GroupRepository.getGroupMessageUnRead((long)originalChat[position].GroupId);
                if (countGroupUnread > 0)
                {
                    viewHolder.txtTime.SetTextColor(Color.YellowGreen);
                    viewHolder.txtMessageCount.Visibility = ViewStates.Visible;
                    viewHolder.txtMessageCount.Text       = countGroupUnread.ToString();
                }
                else
                {
                    viewHolder.txtMessageCount.Visibility = ViewStates.Invisible;
                }

                var GroupDetails = GroupRepository.GetGroupByID(Convert.ToInt64(originalChat[position].GroupId));
                if (GroupDetails != null)
                {
                    viewHolder.lblChatGroupName.Text = GroupDetails.GroupName;
                    if (Convert.ToDateTime(originalChat[position].LastMessageDate).ToLocalTime().Date == DateTime.UtcNow.ToLocalTime().Date)
                    {
                        viewHolder.txtTime.Text = Convert.ToDateTime(originalChat[position].LastMessageDate).ToLocalTime().ToString("hh:mm tt");
                    }
                    else
                    {
                        viewHolder.txtTime.Text = Convert.ToDateTime(originalChat[position].LastMessageDate).ToLocalTime().Date.ToString("MM/dd/yyyy");
                    }
                    if (!string.IsNullOrEmpty(originalChat[position].LastMessage))
                    {
                        viewHolder.lblChatGroupLastMSG.Text = originalChat[position].SenderName + " : " + originalChat[position].LastMessage;
                    }
                    else
                    {
                        var GroupUser = ContactRepository.GetContactbyUserId(GroupDetails.OwnerId);
                        if (GroupUser != null)
                        {
                            viewHolder.lblChatGroupLastMSG.Text = "Created by " + GroupUser.screenName;
                        }
                        else if (GroupDetails.OwnerId == CommonHelper.GetUserId())
                        {
                            viewHolder.lblChatGroupLastMSG.Text = "Created by me";
                        }
                        else
                        {
                            viewHolder.lblChatGroupLastMSG.Text = "Created by Unknown";
                        }
                    }

                    if (GroupDetails.GroupPictureUrl != null)
                    {
                        Picasso.With(context)
                        .Load(GroupDetails.GroupPictureUrl)
                        .Transform(new CircleTransformation())
                        .Fit()
                        .Into(viewHolder.ivgroupdefault);
                    }
                }
                break;
            }
        }
        public void UpdateCell(ChatConversation chatConverstions)
        {
            var chat = ChatConversationRepository.GetConversationIdbyChatId(Convert.ToInt32(chatConverstions.ChatId));

            CommonHelper.SetCircularImage(ProfileImage);

            if (chat != null)
            {
                if (chat.IsGroup == false)
                {
                    var contact = ContactRepository.GetContactbyUserId((long)chat.ContactId);
                    if (contact != null)
                    {
                        if (!string.IsNullOrEmpty(contact.contactPicUrl))
                        {
                            ProfileImage.SetImage(new NSUrl(contact.contactPicUrl), UIImage.FromBundle("default_profile.png"));
                        }
                        else
                        {
                            ProfileImage.Image = new UIImage("default_profile.png");
                        }

                        lblChatUserName.Text = contact.screenName;

                        if (chatConverstions.LastMessageDate.HasValue)
                        {
                            if (Convert.ToDateTime(chatConverstions.LastMessageDate).Date == DateTime.UtcNow.ToLocalTime().Date)
                            {
                                lblChatLastTime.Text = Convert.ToDateTime(chatConverstions.LastMessageDate).ToString("hh:mm tt");
                            }
                            else
                            {
                                lblChatLastTime.Text = Convert.ToDateTime(chatConverstions.LastMessageDate).Date.ToString("MM/dd/yyyy");
                            }
                        }
                        if (!string.IsNullOrEmpty(chatConverstions.LastMessage))
                        {
                            lblChatLastMessage.Text = chatConverstions.LastMessage;
                        }
                        else
                        {
                            lblChatLastMessage.Text = "";
                        }

                        int count = ChatMessageRepository.getChatMessageUnRead(chatConverstions.ChatId);

                        if (count > 0)
                        {
                            lblMessageCount.Hidden = false;
                            lblMessageCount.SetTitle(count.ToString(), UIControlState.Normal);
                        }
                        else
                        {
                            lblMessageCount.Hidden = true;
                        }
                    }
                }
                else
                {
                    var group = GroupRepository.GetGroupByID((long)chat.GroupId);
                    if (group != null)
                    {
                        if (!string.IsNullOrEmpty(group.GroupPictureUrl))
                        {
                            ProfileImage.SetImage(new NSUrl(group.GroupPictureUrl), UIImage.FromBundle("grouplist.png"));
                        }
                        else
                        {
                            ProfileImage.Image = new UIImage("grouplist.png");
                        }

                        lblChatUserName.Text = group.GroupName;

                        if (chatConverstions.LastMessageDate.HasValue)
                        {
                            if (Convert.ToDateTime(chatConverstions.LastMessageDate).Date == DateTime.UtcNow.ToLocalTime().Date)
                            {
                                lblChatLastTime.Text = Convert.ToDateTime(chatConverstions.LastMessageDate).ToString("hh:mm tt");
                            }
                            else
                            {
                                lblChatLastTime.Text = Convert.ToDateTime(chatConverstions.LastMessageDate).Date.ToString("MM/dd/yyyy");
                            }
                        }
                        if (!string.IsNullOrEmpty(chatConverstions.LastMessage))
                        {
                            lblChatLastMessage.Text = chatConverstions.LastMessage;
                        }
                        else
                        {
                            lblChatLastMessage.Text = "";
                        }

                        if (!string.IsNullOrEmpty(chatConverstions.LastMessage))
                        {
                            lblChatLastMessage.Text = chatConverstions.SenderName + " : " + chatConverstions.LastMessage;
                        }
                        else
                        {
                            var GroupUser = ContactRepository.GetContactbyUserId(chatConverstions.OwnerId);
                            if (GroupUser != null)
                            {
                                lblChatLastMessage.Text = "Created by " + GroupUser.screenName;
                            }
                            else
                            {
                                lblChatLastMessage.Text = "Created by me";
                            }
                        }

                        int countGroupUnread = GroupRepository.getGroupMessageUnRead((long)chatConverstions.GroupId);

                        if (countGroupUnread > 0)
                        {
                            lblMessageCount.Hidden = false;
                            lblMessageCount.SetTitle(countGroupUnread.ToString(), UIControlState.Normal);
                        }
                        else
                        {
                            lblMessageCount.Hidden = true;
                        }
                    }
                }
            }
        }