public void DeleteGroupChat(GroupChat groupChat)
 {
     using (var session = _documentStore.Store.OpenSession())
     {
         session.Delete(groupChat.Id);
         session.SaveChanges();
     }
 }
        public async Task <GroupChat> SaveGroupChatAsync(GroupChat groupChat, string id = null)
        {
            using (var session = _documentStore.Store.OpenAsyncSession())
            {
                var now = DateTime.Now;
                groupChat.LastModified = now;

                if (id != null)
                {
                    var member = groupChat.Members.FirstOrDefault(x => x.Id == id);
                    if (member != null)
                    {
                        member.LastAccessed = DateTime.Now;
                    }
                }

                await session.StoreAsync(groupChat);

                await session.SaveChangesAsync();
            }

            return(groupChat);
        }