if (contentManager.checkExistence(parentPath + "/" + name, currentUserSession)) {
throw new GWTJahiaServiceException("A node already exists with name '" + name + "'");
}
JCRNodeWrapper parentNode = currentUserSession.getNode(parentPath);
if (!parentNode.isCheckedOut()) {
parentNode.checkout();
}
JCRPortletNode node = (JCRPortletNode) contentManager.addNode(parentNode, name, gwtJahiaNewPortletInstance.getGwtJahiaPortletDefinition().getPortletType(), null, gwtJahiaNewPortletInstance.getProperties());
node.setApplication(gwtJahiaNewPortletInstance.getGwtJahiaPortletDefinition().getApplicationId(), gwtJahiaNewPortletInstance.getGwtJahiaPortletDefinition().getDefinitionName());