public ActionResult SubmitApplication(ApplicantViewModel model)
        {
            var applicant = new Applicant() { Name = model.UserName, EmailAddress = model.Email, TimeZone = model.TimeZone, Information = model.Information, Age = model.Age, ToonAge = model.ToonAge, Source = model.Source };
            
            ApiInfo api = new ApiInfo() { ApiKey = Convert.ToInt32(model.ApiKey), VerificationCode = model.VerificationCode };
            bool goodAccessMask = api.ValidateAccessMask(ApplicationUser.IDType.Corporation);
            bool goodTZ = (model.TimeZone != "Select a Time Zone");

            if (goodAccessMask && goodTZ)
            {
                applicant.ApiKey = Convert.ToInt32(model.ApiKey);
                applicant.VerificationCode = model.VerificationCode;

                db.Applicants.Add(applicant);
                db.SaveChanges();

                //applicant = db.Applicants.Where(m => m.Name == applicant.Name).Last();
                var application = new Application() { ApplicantId = applicant.Id, Notes = "New application", Status = ApplicationReviewViewModel.ApplicationStatus.Applied.ToString(), DateTimeCreated = DateTime.Now };
                db.Applications.Add(application);
                db.SaveChanges();

                //SendMessage(string.Format(Properties.Settings.Default.NewApp_MessageFormatLine1, applicant.Name, application.DateTimeCreated.ToString("yyyy-MM-dd HH:mm:ss")));

                MessagePayload message = new MessagePayload();
                message.Attachments = new List<MessagePayloadAttachment>();

                message.Attachments.Add(new MessagePayloadAttachment()
                {
                    Text = string.Format(Properties.Settings.Default.NewApp_MessageFormatLine2, applicant.Name, application.DateTimeCreated.ToString("yyyy-MM-dd HH:mm:ss")),
                    TitleLink = string.Format(Properties.Settings.Default.EveWhoPilotURL, applicant.Name.Replace(" ", "+")),
                    Title = Properties.Settings.Default.NewApp_MessageFormatLine1,
                    ThumbUrl = string.Format(Properties.Settings.Default.CharacterImageServerURL, Api.GetCharacterID(applicant.Name), 64.ToString()),
                    Colour = "#FFC200"
                });
                RecruitmentController.SendMessage(message);

                TempData.Clear();
                TempData.Add("Message", "Thank you for your application. A recruiter will contact you shortly.");

                return RedirectToAction("Index", "Home");
            }

            if (!goodAccessMask)
            {
                ViewBag.Message = string.Format("The access mask for the API key you have submitted is not correct ({0}, should be {1}). Please correct this and try again.", api.AccessMask, Properties.Settings.Default.FullAPIAccessMask);
            }
            else if(!goodTZ)
            {
                ViewBag.Message = "Please select a valid Time Zone.";
            }
            return View(model);
        }
        public ActionResult Apply()
        {
            var model = new ApplicantViewModel();
            @ViewBag.FullAccessMask = Properties.Settings.Default.FullAPIAccessMask.ToString();

            return View(model);
        }