private void htmlProcessEntityAdd(HttpServletRequest req,
            HttpServletResponse res) throws ServletException, IOException {
        
        // check if the user pressed cancel
        if (req.getParameter("cancel") != null) {
            if (req.getParameter("entityId") != null) {
                htmlShowEntity(req, res);
            } else {
                htmlShowEntities(req, res);
            }
            return;
        }
        // if you have reached this point, it means we are going to try to
        // add a the entity
        String name = req.getParameter("name");
        String phoneNumber = req.getParameter("phoneNumber");
        String note = req.getParameter("note");
        String sParentId = req.getParameter("entityId");
        String audioName = req.getParameter("audioName");
        int parentId = 0;
        
        // check to make sure parameters are set
        if (name == null || phoneNumber == null || note == null) {
            // //
            System.out
                    .println("do not have all parameters to proceed with add Contact");
            // //
            htmlShowEntities(req, res);
            return;
        }
        
        // trim the entity name
        name = name.trim();
        
        // set parentId as an int
        if (sParentId != null && sParentId.length() > 0) {
            parentId = Integer.parseInt(sParentId);
        }
        
        // put values in a EntityBean
        EntityBean entity = new EntityBean();
        entity.setName(name);
        entity.setPhoneNumber(phoneNumber);
        entity.setNote(note);
        entity.setActive(true);
        entity.setParentId(parentId);
        entity.setAudioName(audioName);
        
        // add to the session
        if (EntityManager.addEntity(entity)) {
            addEntityInSession(req, entity);
        }
        // redirect
        if (parentId == EntityBean.ENTITY_TOP_LEVEL_PARENT_ID) {
            htmlShowEntities(req, res);
        } else {
            htmlShowEntity(req, res);
        }
    }