private Dictionary <string, object> HandleYesRsvp(MpParticipant participant, MpEvent e, int opportunityId, IReadOnlyCollection <int> opportunityIds, String token) { var templateId = AppSetting("RsvpYesTemplate"); var deletedRSVPS = new List <int>(); MpOpportunity previousOpportunity = null; var opportunity = _opportunityService.GetOpportunityById(opportunityId, token); //Try to register this user for the event _eventService.RegisterParticipantForEvent(participant.ParticipantId, e.EventId, opportunity.GroupId); // Make sure we are only rsvping for 1 opportunity by removing all existing responses deletedRSVPS.AddRange(from oid in opportunityIds let deletedResponse = _opportunityService.DeleteResponseToOpportunities(participant.ParticipantId, oid, e.EventId) where deletedResponse != 0 select oid); if (deletedRSVPS.Count > 0) { templateId = AppSetting("RsvpChangeTemplate"); if (opportunityIds.Count != deletedRSVPS.Count) { //Changed yes to yes //prevOppId = deletedRSVPS.First(); previousOpportunity = _opportunityService.GetOpportunityById(deletedRSVPS.First(), token); } } var comments = string.Empty; //anything of value to put in comments? _opportunityService.RespondToOpportunity(participant.ParticipantId, opportunityId, comments, e.EventId, true); return(new Dictionary <string, object>() { { "templateId", templateId }, { "previousOpportunity", previousOpportunity }, { "rsvp", true } }); }