private boolean checkIfNewUser(String pid, Document doc)
    {
        if (pid == null || doc == null){
            throw new IllegalArgumentException("pid or doc are null");
        }

        Element docEle = doc.getDocumentElement();
        if (docEle == null) {
            return true;
        }
        NodeList nl = docEle.getChildNodes();
        if (nl == null){
            return true;
        }

        for (int i = 0; i < nl.getLength(); i++)
        {
            if(nl.item(i).getNodeType() == Node.ELEMENT_NODE){
                Element el = (Element) nl.item(i);
                if (pid.equals(el.getAttribute("pid"))){
                    return false;
                }
            }

        }
        return true;
    }