@Override
  protected ModelAndView onSubmit(
      HttpServletRequest request,
      HttpServletResponse response,
      Object command,
      BindException errors)
      throws ServletException, Exception {
    ArchiveDAO adao = (ArchiveDAO) command;
    if (request.getParameter("male_bg_id_new") != null) {
      // This is a new entry for the table backgrounds
      String newBGName = request.getParameter("male_bg_id_new");

      List bd = bm.getBGDAOByName(newBGName);
      if (bd.size() == 0) {
        // OK lets add a new one
        BackgroundDAO bDAO = adao.getStrainsDAO().getBackgroundDAO(); // . new BackgroundDAO();
        bDAO.setName(newBGName);

        bm.save(bDAO);
        // System.out.println("WOOHOO== " + bDAO.getId_bg() + " BGNAME= " + bDAO.getName());
        adao.setMale_bg_id("" + bDAO.getId_bg() + "");

        // Now regenerate list
        createList();
      }
    }
    if (request.getParameter("female_bg_id_new") != null) {
      // This is a new entry for the table backgrounds
      String newBGName = request.getParameter("female_bg_id_new");

      List bd = bm.getBGDAOByName(newBGName);
      if (bd.size() == 0) {
        // OK lets add a new one
        BackgroundDAO bDAO = adao.getStrainsDAO().getBackgroundDAO(); // new BackgroundDAO();
        bDAO.setName(newBGName);

        bm.save(bDAO);
        // System.out.println("WOOHOO== " + bDAO.getId_bg() + " BGNAME= " + bDAO.getName());
        adao.setFemale_bg_id("" + bDAO.getId_bg() + "");

        // Now regenerate list
        createList();
      }
    }

    am.save(adao);
    System.out.println("saved");
    request
        .getSession()
        .setAttribute(
            "message",
            getMessageSourceAccessor().getMessage("Message", "Your update submitted successfully"));

    return new ModelAndView(getSuccessView());
  }
  @Override
  protected Object formBackingObject(HttpServletRequest request) {
    if (request.getParameter("cryoArchID") != null) {
      archiveID = Integer.parseInt(request.getParameter("cryoArchID"));
    }
    ArchiveDAO aDAO = new ArchiveDAO();
    HttpSession session = request.getSession(true);
    aDAO = am.getReqByArchID(archiveID);
    session.setAttribute("femalebgid", aDAO.getFemale_bg_id());
    session.setAttribute("malebgid", aDAO.getMale_bg_id());
    bm = new BackgroundManager();
    bm.getBackgrounds();
    // Check that background list file has been created by overnight job, if not create it to
    // prevent error
    try {
      BufferedReader in =
          new BufferedReader(new FileReader(getFileLocation() + "bgNamesList.emma"));
      in.close();

    } catch (IOException e) {
      createList();
    }
    return aDAO;
  }