private static function submit(MongoId $jobId, MongoId $studentId, array $questions)
 {
     $answers = array();
     foreach ($questions as $_id => $answer) {
         $answers[] = ['_id' => $_id, 'answer' => $answer];
     }
     $application = ApplicationStudent::save($jobId, $studentId, $answers);
     $applicationId = $application->getId();
     $submitted = ApplicationStudent::submit($applicationId);
     if ($submitted) {
         $job = JobModel::getByIdMinimal($jobId);
         $jobTitle = $job['title'];
         $linkApplicants = "http://sublite.net/employers/viewapplicants/{$jobId}";
         $linkManage = "http://sublite.net/employers/home";
         $recruiterId = $job['recruiter'];
         $recruiter = RecruiterModel::getByIdMinimal($recruiterId);
         $recruiterFirstname = $recruiter['firstname'];
         $recruiterEmail = $recruiter['email'];
         $message = "\n          Hi {$recruiterFirstname},\n          <br /><br />\n          You have received a new applicant for your job: <b>{$jobTitle}</b>!\n          <br /><br />\n          To unlock and view this application, go to\n          <a href='{$linkApplicants}'>View Applicants</a>.\n          <br />\n          To manage your jobs, go to <a href='{$linkManage}'>Manage</a>.\n          <br /><br />\n          View Applicants: <a href='{$linkApplicants}'>{$linkApplicants}</a><br />\n          Manage Jobs: <a href='{$linkManage}'>{$linkManage}</a><br />\n          <br /><br />\n          -------------------<br />\n          Team SubLite\n          <br /><br />\n          Please let us know if you have any questions. We hope you find the\n          right candidate for your job.\n        ";
         sendgmail([$recruiterEmail], "*****@*****.**", "New Applicant for '{$jobTitle}' | SubLite", $message);
         //send an email to the student
         $companyId = $job['company'];
         $company = CompanyModel::getById($companyId);
         $companyName = $company['name'];
         $student = StudentModel::getByIdMinimal($studentId);
         $studentFirstName = $student['name'];
         $studentEmail = $student['email'];
         $linkApplication = "http://sublite.net/jobs/application/{$applicationId}";
         $linkJob = "http://sublite.net/job?id={$jobId}";
         $linkJobSearch = "http://sublite.net/jobs/search";
         $linkJobsByCompany = "http://sublite.net/jobs/search?byrecruiter={$recruiterId}";
         $message = "\n          Hi {$studentFirstName},\n          <br />\n          <br />{$companyName} has successfully received your <a href='{$linkApplication}'>application</a> for <b>{$jobTitle}</b>!<br />\n          <br />View your application: {$linkApplication}\n          <br />View the job you applied to {$linkJob}\n          <br />View more jobs by {$linkJobsByCompany}<br />\n          <br />You are now one step closer to finding your perfect summer experience! Take more steps by applying to more jobs: {$linkJobSearch}<br />\n          -------------------<br />\n          Good luck!\n          <br />\n          Team SubLite\n        ";
         sendgmail([$studentEmail], "*****@*****.**", "Confirmation for Job Application", $message);
         self::redirect("../application/{$applicationId}");
     }
     self::error("You must attach a resume to your profile in order to submit " . "an application.");
 }