public async Task <IActionResult> PutAttendee(int meetingId, int attendeeId, AttendeeRequestViewModel model)
        {
            if (attendeeId != model.Id)
            {
                return(BadRequest());
            }

            var exists = _meetingRepository.Exists(meetingId);

            if (false == exists)
            {
                return(BadRequest());
            }

            var entity = await _attendeeRepository.GetAsync(model.Id);

            if (entity == null)
            {
                return(NotFound());
            }

            if (meetingId != entity.MeetingId)
            {
                return(BadRequest());
            }

            if (null == model.Member)
            {
                entity.MemberId = null;
                entity.Member   = null;
            }
            else
            {
                entity.MemberId = model.Member.Id;
                entity.Member   = model.Member.Name;
            }
            _attendeeRepository.Update(entity);

            try
            {
                await _attendeeRepository.CompleteAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AttendeeExists(attendeeId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <AttendeeViewModel> > PostAttendee(int meetingId, AttendeeRequestViewModel model)
        {
            var exists = _meetingRepository.Exists(meetingId);

            if (false == exists)
            {
                return(BadRequest());
            }

            var entity = new Attendee
            {
                MeetingId = meetingId,
                MemberId  = model.Member?.Id,
                RoleId    = model.RoleId,
            };

            _attendeeRepository.Add(entity);

            await _attendeeRepository.CompleteAsync();

            entity = await _attendeeRepository.GetWithRolesAsync(entity.Id);

            return(CreatedAtAction("GetAttendee", new { id = entity.Id }, ViewModelHelper.Convert(entity)));
        }