public ActionResult Send(List <int> people, NotificationTracking notificationTracking, EmailQueue emailQueue, int?mailingListId, int[] attachmentIds)
        {
            if ((people == null || people.Count <= 0) && !mailingListId.HasValue)
            {
                ModelState.AddModelError("People", "No person has been selected to receive the notification.");
            }

            var tracking = new List <NotificationTracking>();

            ModelState.Clear();
            notificationTracking.TransferValidationMessagesTo(ModelState);
            if (string.IsNullOrWhiteSpace(emailQueue.Subject))
            {
                ModelState.AddModelError("EmailQueue.Subject", "You must enter a subject.");
            }

            var mailingList = mailingListId.HasValue ? Repository.OfType <MailingList>().GetNullableById(mailingListId.Value) : null;

            // save the objects if we are good
            if (ModelState.IsValid)
            {
                tracking = ProcessTracking(ModelState, people, notificationTracking, attachmentIds, emailQueue, mailingList);

                foreach (var a in tracking)
                {
                    _notificationTrackingRepository.EnsurePersistent(a);
                }

                Message = string.Format(Messages.Saved, "Notification tracking");

                if (tracking.Count == 1 && !mailingListId.HasValue)
                {
                    var person = tracking[0].Person;

                    var url = Url.Action("AdminEdit", "Person", new { id = person.User.Id, seminarId = SiteService.GetLatestSeminar(Site).Id });
                    return(Redirect(string.Format("{0}#notifications", url)));
                }

                // redirect back to the seminar controller details
                return(this.RedirectToAction <SeminarController>(a => a.Details(null)));
            }

            // not good, hand the page back
            var ntViewModel = NotificationTrackingViewModel.Create(Repository, Site, notificationTracking, mailingList: mailingList);

            ntViewModel.People = tracking.Select(a => a.Person).ToList();

            var viewModel = SendNotificationViewModel.Create(Repository, ntViewModel, emailQueue);

            return(View(viewModel));
        }
        /// <summary>
        /// Sending a notification through this program
        /// </summary>
        /// <returns></returns>
        public ActionResult Send(int?personId)
        {
            Person person = null;

            if (personId.HasValue)
            {
                person = _personRepository.GetNullableById(personId.Value);
            }

            var ntViewModel = NotificationTrackingViewModel.Create(Repository, Site, person: person);

            ntViewModel.NotificationTracking.NotifiedBy         = CurrentUser.Identity.Name;
            ntViewModel.NotificationTracking.Seminar            = SiteService.GetLatestSeminar(Site);
            ntViewModel.NotificationTracking.NotificationMethod = _notificationMethodRepository.GetById(StaticIndexes.NotificationMethod_Email);

            var viewModel = SendNotificationViewModel.Create(Repository, ntViewModel);

            return(View(viewModel));
        }