public async Task <IList <ContentChatViewModel> > GetMessage([FromUri] PagingParameterModel pagingParameterModel, Guid idRoom)
        {
            var listMessage        = context.ContentChats.Where(t => t.RoomId == idRoom).OrderBy(t => t.TimeChat).ToList();
            int count              = listMessage.Count();
            int CurrentPage        = pagingParameterModel.pageNumber;
            int PageSize           = pagingParameterModel.pageSize;
            int TotalCount         = count;
            int TotalPages         = (int)Math.Ceiling(count / (double)PageSize);
            var items              = listMessage.Skip((CurrentPage - 1) * PageSize).Take(PageSize).ToList();
            var previousPage       = CurrentPage > 1 ? "1" : "0";
            var nextPage           = CurrentPage < TotalPages ? "1" : "0";
            var paginationMetadata = new
            {
                totalCount  = TotalCount,
                pageSize    = PageSize,
                currentPage = CurrentPage,
                totalPages  = TotalPages,
                previousPage,
                nextPage
            };

            HttpContext.Current.Response.Headers.Add("Paging-Headers", JsonConvert.SerializeObject(paginationMetadata));
            var result = new List <ContentChatViewModel>();

            foreach (var t in items)
            {
                var chat = await firebaseClient.Child(ROOM)
                           .Child(idRoom.ToString())
                           .Child(t.Id.ToString())
                           .OnceAsync <ContentChatFB>() as ContentChatFB;

                var chatModel = new ContentChatViewModel()
                {
                    EmojiId     = chat.EmojiId == null ? new Guid("") : Guid.Parse(chat.EmojiId),
                    ContentText = chat.ContentText,
                    PathAudio   = chat.PathAudio,
                    PathFilde   = chat.PathFilde,
                    PathImage   = chat.PathImage,
                    PathVideo   = chat.PathVideo,
                    RoomId      = idRoom,
                    Type        = chat.Type
                };
                result.Add(chatModel);
            }

            return(result);
        }
        public async Task <IHttpActionResult> SendContentChat([FromBody] ContentChatViewModel contentChatViewModel)
        {
            var user        = GetUserLogin();
            var contentChat = new ContentChat()
            {
                EmojiId  = contentChatViewModel.EmojiId,
                RoomId   = contentChatViewModel.RoomId,
                TimeChat = DateTime.Now,
                UserId   = user.Id
            };

            var ccfb = new ContentChatFB()
            {
                Id          = contentChat.Id.ToString(),
                ContentText = contentChatViewModel.ContentText,
                Type        = contentChatViewModel.Type,
                EmojiId     = contentChat.EmojiId.ToString(),
                UserId      = user.Id,
                PathAudio   = contentChatViewModel.PathAudio,
                PathFilde   = contentChatViewModel.PathFilde,
                PathImage   = contentChatViewModel.PathImage,
                PathVideo   = contentChatViewModel.PathVideo,
                TimeChat    = DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss")
            };

            await firebaseClient.Child(ROOM)
            .Child(contentChat.RoomId.ToString())
            .Child(contentChat.Id.ToString())
            .PutAsync(ccfb);

            context.ContentChats.Add(contentChat);

            var listJoin = context.UserJoinRooms.Where(t => t.RoomId == contentChatViewModel.RoomId).ToList();

            foreach (var item in listJoin)
            {
                item.LastInterractive = DateTime.Now;
            }

            await context.SaveChangesAsync();

            return(Ok());
        }