@Override
	public String perform(HttpServletRequest request) {
		List<String> errors = new ArrayList<String>();
		HttpSession session = request.getSession();
		request.setAttribute("errors", errors);
		String success;

		try {
			CreateUserForm form = formBeanFactory.create(request);
			request.setAttribute("form", form);
			request.setAttribute("userType", Global.getUserType(session));
			request.setAttribute("username", Global.getUserName(session));

			logger.debug("CreateUserAction called");

			if (!form.isPresent())
				return "createUser.jsp";
			errors.addAll(form.getValidationErrors());
			if (errors.size() > 0)
				return "createUser.jsp";

			if (form.getUserType().equals("Employee")) {
				if (Init.employeeDAO.lookup(form.getUsername()) == null) {
					saveEmployee(form);
				} else {
					errors.add("Employee with the same username already exists, change the username and try again.");
					return "createUser.jsp";
				}
			} else {
				if (Init.customerDAO.lookup(form.getUsername()) == null) {
					saveCustomer(form);

				} else {
					errors.add("Customer with the same username already exists, change the username and try again.");
					return "createUser.jsp";
				}
			}

			success = "The user account was created succesfully";
			request.setAttribute("success", success);
		} catch (MyDAOException e) {
			logger.error(e.getMessage());
			errors.add("Internal error, please try again later.");
			return "createUser.jsp";
		} catch (FormBeanException e) {
			logger.error(e.getMessage());
			errors.add("Internal error, please try again later.");
			return "createUser.jsp";
		}

		return "createUser.jsp";
	}