* @throws RepositoryException could not find folderPath node
*/
private Page createPage(ResourceResolver resourceResolver, String folderPath, String nodeName, String templatePath,
String title) throws RepositoryException, WCMException {
final PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
final Template template = pageManager.getTemplate(templatePath);
if (template != null) {
// A template is defined so use that
return pageManager.create(folderPath, nodeName, templatePath, title, false);
} else {
// Manually create the page nodes to prevent the creation of nt:unstructured-based jcr:content node
final Session session = resourceResolver.adaptTo(Session.class);
final Node folderNode = session.getNode(folderPath);