public CreateGroupChatResponse CreateGroupChat(ISession session, CreateGroupChatRequest request)
        {
            var response = request.CreateResponse <CreateGroupChatResponse>();

            GroupChat group = new GroupChat {
                GroupId = Guid.NewGuid(), CreatedAt = DateTime.UtcNow, OwnerId = session.UserId
            };

            group.Participants = new List <GroupChatParticipant> {
                new GroupChatParticipant {
                    UserId = session.UserId
                }
            };
            group.Participants.AddRange(request.Participants.Select(i => new GroupChatParticipant {
                UserId = i
            }));

            foreach (var participant in group.Participants)
            {
                _groupChatsRepository.AddGroupToUser(participant.UserId, group.GroupId);
                participant.Devices = _devicesRepository.GetDevices(participant.UserId);
            }

            foreach (var device in group.Participants.SelectMany(p => p.Devices))
            {
                if (device != session.DeviceId)
                {
                    _groupChangedEventManager.DeliverEventToDevice(new GroupChangedEvent
                    {
                        ReceiverDeviceId = device,
                        ChangesAuthorId  = session.UserId,
                        GroupId          = group.GroupId,
                        Participants     = group.Participants,
                        Type             = GroupChangedEvent.ChangesType.ParticipantsAdded
                    });
                }
            }

            _groupChatsRepository.UpdateOrCreateGroup(group);

            response.GroupId = group.GroupId;
            return(response);
        }