ActionResult PerformTransition(User user, DecisionInput input, Action<Submission> action, string successText)
        {
            if (ModelState.IsValid)
            {
                using (var db = new DataContext(user))
                {
                    var submission = db.Submissions.Include(x => x.CallForSpeakers)
                        .Include(x => x.Submitter)
                        .SingleOrDefault(x => x.Id == input.Id &&
                            x.CallForSpeakers.Id == input.CallForSpeakersId &&
                            x.CallForSpeakers.Organizer.Id == user.Id);

                    if (submission != null)
                    {
                        action(submission);
                        db.SaveChanges();
                        Success(successText);
                    }
                    else
                    {
                        Error("Invalid submission");
                    }
                    return RedirectToAction("Review", new { id = input.CallForSpeakersId });
                }
            }
            return RenderReview(user, input.CallForSpeakersId);
        }
 public ActionResult Accept(User user, DecisionInput input)
 {
     return PerformTransition(user, input, x => x.Accept(_email), "You have successfully accepted this submission.");
 }