public async Task CreateOrEditChannel()
        {
            var editableChannel = fillTestDbHelper.Channels.FirstOrDefault();
            var validUser       = editableChannel.ChannelUsers.FirstOrDefault(channelUser => channelUser.ChannelUserRole >= ChannelUserRole.Administrator);
            var invalidUser     = editableChannel.ChannelUsers.FirstOrDefault(channelUser => channelUser.ChannelUserRole == ChannelUserRole.Subscriber);

            editableChannel.ChannelName = "Edited channel name";
            var actualChannel = await createChannelsService.CreateOrEditChannelAsync(ChannelConverter.GetChannel(editableChannel), validUser.UserId, null);

            Assert.True(editableChannel.ChannelName == actualChannel.ChannelName);
            await Assert.ThrowsAsync <PermissionDeniedException>(async() =>
                                                                 await createChannelsService.CreateOrEditChannelAsync(ChannelConverter.GetChannel(editableChannel), invalidUser.UserId, null));

            var users              = fillTestDbHelper.Users.Skip(1);
            var creator            = fillTestDbHelper.Users.FirstOrDefault();
            var newExpectedChannel = new ChannelVm
            {
                About        = RandomExtensions.NextString(10),
                ChannelName  = "Created channel",
                ChannelUsers = users.Select(user => new ChannelUserVm
                {
                    UserId          = user.Id,
                    ChannelUserRole = ChannelUserRole.Subscriber
                }).ToList()
            };
            var newActualChannel = await createChannelsService.CreateOrEditChannelAsync(newExpectedChannel, creator.Id, newExpectedChannel.ChannelUsers);

            Assert.True(newExpectedChannel.ChannelUsers.Count() + 1 == newActualChannel.ChannelUsers.Count());
        }
        public async Task HandleAsync()
        {
            var editableChannel = await loadChannelsService.GetChannelByIdAsync(notice.Channel.ChannelId.Value).ConfigureAwait(false);

            ChannelVm channel = await createChannelsService.CreateOrEditChannelAsync(notice.Channel, notice.RequestorId, notice.Subscribers).ConfigureAwait(false);

            if (editableChannel?.ChannelName == channel.ChannelName)
            {
                var systemMessageInfo = SystemMessageInfoFactory.CreateNameChangedMessageInfo(editableChannel.ChannelName, channel.ChannelName);
                var message           = await systemMessagesService.CreateMessageAsync(ObjectsLibrary.Enums.ConversationType.Channel, channel.ChannelId.Value, systemMessageInfo);

                conversationsNoticeService.SendSystemMessageNoticeAsync(message);
            }
            IEnumerable <long> usersId = await loadChannelsService.GetChannelUsersIdAsync(channel.ChannelId.GetValueOrDefault()).ConfigureAwait(false);

            conversationsNoticeService.SendChannelNoticeAsync(channel, usersId.ToList());
        }