public async Task Handle(UpdateHearingParticipantsCommand command)
        {
            var hearing = await _context.VideoHearings
                          .Include(x => x.Participants).ThenInclude(x => x.Person.Organisation)
                          .Include(x => x.Participants).ThenInclude(x => x.HearingRole.UserRole)
                          .Include(x => x.Participants).ThenInclude(x => x.CaseRole)
                          .Include(x => x.Participants).ThenInclude(x => x.LinkedParticipants)
                          .Include(h => h.Endpoints).ThenInclude(x => x.DefenceAdvocate)
                          .SingleOrDefaultAsync(x => x.Id == command.HearingId);

            if (hearing == null)
            {
                throw new HearingNotFoundException(command.HearingId);
            }

            _context.Update(hearing);

            foreach (var removedParticipantId in command.RemovedParticipantIds)
            {
                hearing.RemoveParticipantById(removedParticipantId, false);
            }

            await _hearingService.AddParticipantToService(hearing, command.NewParticipants);

            _hearingService.ValidateHostCount(hearing.Participants);

            var participants = hearing.GetParticipants().ToList();

            foreach (var newExistingParticipantDetails in command.ExistingParticipants)
            {
                var existingParticipant = participants.FirstOrDefault(x => x.Id == newExistingParticipantDetails.ParticipantId);

                if (existingParticipant == null)
                {
                    throw new ParticipantNotFoundException(newExistingParticipantDetails.ParticipantId);
                }

                existingParticipant.LinkedParticipants.Clear();

                existingParticipant.UpdateParticipantDetails(newExistingParticipantDetails.Title, newExistingParticipantDetails.DisplayName,
                                                             newExistingParticipantDetails.TelephoneNumber, newExistingParticipantDetails.OrganisationName);

                if (existingParticipant.HearingRole.UserRole.IsRepresentative)
                {
                    ((Representative)existingParticipant).UpdateRepresentativeDetails(
                        newExistingParticipantDetails.RepresentativeInformation.Representee);
                }
            }

            await _hearingService.CreateParticipantLinks(participants, command.LinkedParticipants);

            await _context.SaveChangesAsync();
        }
        public async Task Handle(AddParticipantsToVideoHearingCommand command)
        {
            var hearing = await _context.VideoHearings
                          .Include(x => x.Participants).ThenInclude(x => x.Person.Address)
                          .Include(x => x.Participants).ThenInclude(x => x.Person.Organisation)
                          .Include(x => x.Participants).ThenInclude(x => x.HearingRole.UserRole)
                          .Include(x => x.Participants).ThenInclude(x => x.CaseRole)
                          .SingleOrDefaultAsync(x => x.Id == command.HearingId);

            if (hearing == null)
            {
                throw new HearingNotFoundException(command.HearingId);
            }

            _context.Update(hearing);
            await _hearingService.AddParticipantToService(hearing, command.Participants);

            await _context.SaveChangesAsync();
        }