public void AcceptGroupInvite([FromBody] string messageId) { var userId = HttpContext.User.Id(); var message = _messageSource.GetMessageById(userId, messageId); if (message == null || message.Type != "Group") { return; } var groupInvite = message as GroupInviteMessage; var groupId = groupInvite.GroupId; _groupSource.AddUser(groupId, userId); var user = _userSource.Get(userId); user.Groups.Add(groupId); _userSource.Update(user); _messageSource.DeleteMessage(userId, groupInvite.MessageId); }