protected void ShowMainScreen(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		// set the encoding, otherwise database is encoded wrongly
		request.setCharacterEncoding("UTF-8");

		// so, 2 ways to be here - there is session with our data (then it was
		// post),
		// or there isnt - then its get

		// there are two ways to arrive here through get method
		// either with id already set (validate it!) for editing or id=new or
		// id=0

		// get the session
		HttpSession session = request.getSession();
		// get the viewmodel data from session
		AdminUnitTypeVM formData = (AdminUnitTypeVM) session
				.getAttribute("formData");

		// if no viewmodel in session, then normally this is first call through
		// get
		// so check get parameters and populate viewmodel with data from dao
		if (formData == null) {
			session.removeAttribute("errors");
			formData = processGET(request, response);

		} else {
			// formData was there, so this is post. lets update the viewmodel
			// with changes the user wants to make

			// maybe it was cancel?
			if (cancelWasPressed(request, response)) {
				return;
			}

			// fill out viewmodel with first data
			formData = updateViewModelFieldsForDB(request, formData);

			// do some simple validation - so at least code and name are set
			// (and should be unique)
			List<String> errors = getValidationErrors(request);
			if (!errors.isEmpty()) {
				session.setAttribute("errors", errors);
			} else {
				session.removeAttribute("errors");
			}

			// AdminUnitTypeMaster (0-"---": no master)
			System.out
					.println("AdminUnitTypeMaster_adminUnitTypeID:"
							+ request
									.getParameter("AdminUnitTypeMaster_adminUnitTypeID"));

			// was AdminUnitTypeMaster dropdown changed?
			formData = updateUnitTypeMaster(request, formData);

			// now the tricky part - scan through several possible submit
			// buttons
			// which button was clicked?
			Enumeration<String> paramNames = request.getParameterNames();
			while (paramNames.hasMoreElements()) {
				String paramName = paramNames.nextElement();

				// table of subordinates for this adminUnitType
				// every line has separate submit button, with item sequence no
				// added to each button name.
				if (paramName.startsWith("RemoveButton_")) {
					formData = removeSubordinate(formData, paramName);
				}

				// add new subordinate
				if (paramName.equals("AddSubordinateButton")) {
					formData = addSubordinate(formData, request);
				}

				// global save and exit, no validation errors
				if (paramName.equals("SubmitButton") && errors.isEmpty()) {
					submitToDataBase(formData, response);
					return;
				}

			}

		}

		// save the viewmodel for jsp dispatcher into session
		session.setAttribute("formData", formData);

		// call the dispatcher
		request.getRequestDispatcher("AdminUnitTypeScreen.jsp").forward(
				request, response);
	}