private void initPages() {
   List<PageEntity> roots = getDao().getPageDao().getByParent("");
   if (roots.size() == 0) {
     TemplateEntity template = getDao().getTemplateDao().getByUrl("simple");
     addPage("Home page", "/", HOME_PAGE_FILE, template.getId(), 0, true, true);
     getBusiness()
         .getContentPermissionBusiness()
         .setPermission("/", guests, ContentPermissionType.READ);
     addPage("Site user Login", "/login", LOGIN_PAGE_FILE, template.getId(), 0, true, false);
     addPage("Search", "/search", SEARCH_PAGE_FILE, template.getId(), 1, false, false);
   }
 }
 @Override
 public List<String> remove(List<Long> ids) {
   List<String> result = new ArrayList<String>();
   for (Long id : ids) {
     TemplateEntity template = getDao().getTemplateDao().getById(id);
     if (template == null) {
       continue;
     }
     List<PageEntity> pages = getDao().getPageDao().selectByTemplate(id);
     if (pages.size() > 0) {
       result.add(
           Messages.get(
               "template.has_references", template.getTitle(), pages.get(0).getFriendlyURL()));
     } else {
       getDao().getTemplateDao().remove(id);
     }
   }
   return result;
 }
 @Override
 public List<String> validateBeforeUpdate(final TemplateEntity template) {
   List<String> errors = new ArrayList<String>();
   if (template.getId() == null) {
     TemplateEntity myTemplate = getDao().getTemplateDao().getByUrl(template.getUrl());
     if (myTemplate != null) {
       errors.add(Messages.get("template.already_exists"));
     }
   }
   if (StringUtil.isEmpty(template.getUrl())) {
     errors.add(Messages.get("url_is_empty"));
   }
   if (StringUtil.isEmpty(template.getTitle())) {
     errors.add(Messages.get("title_is_empty"));
   }
   if (StringUtil.isEmpty(template.getContent())) {
     errors.add(Messages.get("content_is_empty"));
   }
   return errors;
 }