public ActionResult Create(int surveyId)
        {
            if (_printedSurveyRepository.Queryable.Count(a => a.UserId == CurrentUser.Identity.Name) >= 100)
            {
                Message = "Maximum surveys reached, please delete existing surveys before duplicating more.";
                return this.RedirectToAction(a => a.Index());
            }

            var survey = _surveyRepository.Queryable.Single(a => a.Id == surveyId && a.IsActive);
            var printedSurvey = new PrintedSurvey();
            printedSurvey.Survey = survey;
            printedSurvey.UserId = CurrentUser.Identity.Name;

            foreach (var question in survey.Questions.Where(a => a.Category.IsCurrentVersion && a.Category.IsCurrentVersion && a.IsActive))
            {
                var psq = new PrintedSurveyQuestion();
                psq.PrintedSurvey = printedSurvey;
                psq.Question = question;
                psq.Photo = question.PrimaryPhoto;
                psq.Order = question.Order;
                if (psq.Photo == null || psq.Photo.IsPrintable == false || psq.Photo.IsActive == false)
                {
                    psq.Photo = question.Photos.FirstOrDefault(a => a.IsPrintable && a.IsActive);
                }

                printedSurvey.PrintedSurveyQuestions.Add(psq);
            }

            _printedSurveyRepository.EnsurePersistent(printedSurvey);

            return this.RedirectToAction(a => a.SetName(printedSurvey.Id));
        }
        public ActionResult SetName(int id, PrintedSurvey printedSurvey)
        {
            var userId = CurrentUser.Identity.Name;
            var printedSurveyToEdit = _printedSurveyRepository.Queryable.Single(a => a.Id == id && a.UserId == userId);

            printedSurveyToEdit.Name = printedSurvey.Name;
            _printedSurveyRepository.EnsurePersistent(printedSurveyToEdit);

            return this.RedirectToAction(a => a.SelectPhotos(id));
        }
        public ActionResult SelectPhotos(int id, PrintedSurvey printedSurvey)
        {
            var userId = CurrentUser.Identity.Name;
            var printedSurveyToEdit = _printedSurveyRepository.Queryable.Single(a => a.Id == id && a.UserId == userId);
            printedSurveyToEdit.Name = printedSurvey.Name;
            if (ModelState.IsValid)
            {
                _printedSurveyRepository.EnsurePersistent(printedSurveyToEdit);
                Message = "File name updated";
                //return this.RedirectToAction(a => a.Index());
            }
            else
            {
                Message = "There were errors updating the name";
            }

            return View(printedSurveyToEdit);
        }