public async Task <string> UpdateGroup(ChatGroup chatGroup, string userId)
        {
            ChatGroup oldGroup = chatGroupList.GetGroupByGroupId(chatGroup.GroupId);

            if (oldGroup != null)
            {
                if (oldGroup.HasId(userId))
                {
                    //check creator id
                    if (chatGroup.CreatorId != oldGroup.CreatorId && userId != oldGroup.CreatorId)
                    {
                        return("You can't change creator id");
                    }
                    //check group name
                    if (chatGroup.GroupName != oldGroup.GroupName && userId != oldGroup.CreatorId)
                    {
                        return("You can't change group name");
                    }

                    oldGroup.CreatorId = chatGroup.CreatorId;
                    oldGroup.GroupName = chatGroup.GroupName;
                    await cloudDatabase.UpdateChatGroup(oldGroup);
                    await UpdateChatGroup(oldGroup);

                    return(null);
                }
                else
                {
                    return("You are not a member in this chat group.");
                }
            }
            else
            {
                return("Wrong group.");
            }
        }
 public ChatGroup GetGroupByGroupId(string groupId)
 {
     return(chatGroupList.GetGroupByGroupId(groupId).Copy());
 }