private void DoSetParticipants(
            Itinerary itinerary,
            ItineraryStop itineraryStop,
            IEnumerable <Participant> itineraryParticipants,
            ItineraryStopParticipants itineraryStopParticipants)
        {
            var notAllowedParticipantsById = itineraryStopParticipants.ParticipantIds.Except(itineraryParticipants.Select(x => x.ParticipantId).Distinct());

            var validationEntity = new ItineraryStopParticipantsValidationEntity(notAllowedParticipantsById);

            itineraryStopParticipantsValidator.ValidateUpdate(validationEntity);

            Contract.Assert(itineraryStopParticipants.Audit.GetType() == typeof(Update), "The audit type must be an update.  The itinerary create date should not change.");
            itineraryStopParticipants.Audit.SetHistory(itineraryStop);
            itineraryStopParticipants.Audit.SetHistory(itinerary);
            SetParticipants(itineraryStopParticipants.ParticipantIds.ToList(), itineraryStop, x => x.Participants);
        }
        /// <summary>
        /// Sets the participants on the itinerary stop.
        /// </summary>
        /// <param name="itineraryStopParticipants">The business entity containing the participants by id that should be set on the itinerary.</param>
        /// <returns>The task.</returns>
        public async Task SetParticipantsAsync(ItineraryStopParticipants itineraryStopParticipants)
        {
            var itineraryStop = await CreateGetItineraryStopByIdQuery(itineraryStopParticipants.ItineraryStopId).FirstOrDefaultAsync();

            throwIfModelDoesNotExist(itineraryStopParticipants.ItineraryStopId, itineraryStop, typeof(ItineraryStop));

            var itinerary = itineraryStop.Itinerary;

            throwSecurityViolationIfDifferentItinerary(itineraryStopParticipants.Audit.User.Id, itineraryStopParticipants, itinerary);
            throwSecurityViolationIfDifferentProject(itineraryStopParticipants.Audit.User.Id, itinerary, itineraryStopParticipants.ProjectId);
            var itineraryParticipants = itinerary.Participants;

            DoSetParticipants(
                itinerary: itinerary,
                itineraryStop: itineraryStop,
                itineraryParticipants: itineraryParticipants,
                itineraryStopParticipants: itineraryStopParticipants);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="itineraryStopParticipants"></param>
 /// <returns></returns>
 public Task SetParticipantsAsync(ItineraryStopParticipants itineraryStopParticipants)
 {
     Contract.Requires(itineraryStopParticipants != null, "The itineraryStopParticipants must not be null.");
     return(Task.FromResult <object>(null));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="itineraryStopParticipants"></param>
 public void SetParticipants(ItineraryStopParticipants itineraryStopParticipants)
 {
     Contract.Requires(itineraryStopParticipants != null, "The itineraryStopParticipants must not be null.");
 }