} else {
                        $PageRoute->delete();
                    }
                }
            }
            $new_routes = $Form->receive(array('new_pattern'));
            if (count($new_routes)) {
                foreach ($new_routes as $pattern) {
                    if (trim($pattern) != '') {
                        $PageRoute = $PageRoutes->create(array('pageID' => $Page->id(), 'routePattern' => $pattern));
                    }
                }
            }
            $Form->reset_field('new_pattern');
        }
        $Alert->set('success', PerchLang::get('Successfully updated'));
    }
}
$created = false;
if (isset($_GET['created'])) {
    $Alert->set('success', PerchLang::get('Your page has been successfully created. Return to %spage listing%s', '<a href="' . PERCH_LOGINPATH . '/core/apps/content/">', '</a>'));
    $created = true;
}
$Roles = new PerchUserRoles();
$roles = $Roles->all();
$details = $Page->to_array();
$navgroups = $NavGroups->all();
if (PERCH_RUNWAY) {
    $routes = $PageRoutes->get_routes_for_page($Page->id());
    $collections = $Collections->all();
}