private void InviteUser(IEmailService emailservice, User actor, User target, bool asOwner, Reservation reservation) { Debug.WriteLine("Should have invited user, but added as participant instead. Please fix 'InviteUser' in 'ReservationController.cs' if the messaging and invitation system is implemented."); var participant = reservation.Participants.Find(x => x.UserID == target.Id); if (participant == null) { reservation.Participants.Add(new Participant(reservation, target, asOwner, DateTime.Now)); _context.SaveChanges(); emailservice.AddedAsParticipant(target, actor, reservation, _context); return; } else { var participantchange = participant.GenerateChangeCopy(DateTime.Now); participant.IsOwner = asOwner; _context.ParticipantChanges.Add(participantchange); _context.Participants.Add(participant); _context.SaveChanges(); emailservice.AddedAsParticipant(target, actor, reservation, _context); return; } }