@Atomic
 private CareerWorkshopApplication retrieveThisWorkshopApplication(
     Student student, CareerWorkshopApplicationEvent event) {
   for (CareerWorkshopApplication application : student.getCareerWorkshopApplicationsSet()) {
     if (application.getCareerWorkshopApplicationEvent() == event) {
       return application;
     }
   }
   return new CareerWorkshopApplication(student, event);
 }
  public ActionForward submitApplication(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CareerWorkshopApplication application = getDomainObject(request, "applicationExternalId");

    if (isApplicationPeriodExpired(application)) {
      addActionMessage("error", request, "error.careerWorkshops.applicationPeriodExpired");
      return prepare(actionMapping, actionForm, request, response);
    }

    boolean comingFromSubmission = true;
    String[] sessionPreferences = new String[CareerWorkshopSessions.values().length];
    for (CareerWorkshopSessions careerWorkshopSessions : CareerWorkshopSessions.values()) {
      sessionPreferences[careerWorkshopSessions.ordinal()] =
          (String) getFromRequest(request, careerWorkshopSessions.name());
    }
    application.setSessionPreferences(sessionPreferences);

    String[] themePreferences = new String[CareerWorkshopThemes.values().length];
    for (CareerWorkshopThemes careerWorkshopThemes : CareerWorkshopThemes.values()) {
      themePreferences[careerWorkshopThemes.ordinal()] =
          (String) getFromRequest(request, careerWorkshopThemes.name());
    }
    application.setThemePreferences(themePreferences);

    application.sealApplication();

    request.setAttribute("comingFromSubmission", comingFromSubmission);

    request.setAttribute("application", application);
    return actionMapping.findForward("careerWorkshopApplicationForm");
  }
 private boolean isApplicationPeriodExpired(CareerWorkshopApplication application) {
   DateTime thisInstant = new DateTime();
   return thisInstant.isAfter(application.getCareerWorkshopApplicationEvent().getEndDate());
 }