public static function initialize($request)
    {
        Menu::setPrimaryMenuID();

        //Backend
        if (isInAdmin()) {
            $menuLinkID = (is_numeric(Input::get('menu_link_id')) ? Input::get('menu_link_id') : false);
            if($menuLinkID) {
                self::setCurrent(self::findByID($menuLinkID));
            }
        }else{ // frontend
            Post::sethomepage();

            // Set active menulinks
            self::setActiveIDs();

            // Set home page MenuLink if home page is requested
            $getCurrentPath = Request::path();
            if($getCurrentPath == '/' || $getCurrentPath == App::getLocale()) {
                self::setCurrent(Post::gethomepage());
            }else if(self::getActiveIDs()) {
                //or if any other menulink is active
                self::setCurrent(self::findByID(array_first(self::getActiveIDs())));
            }

            // Front page should not have duplicate urls
            if(Request::route('postSlug') && Request::route('postSlug') == Post::gethomepage()->slug) {
                Redirect::to('/', 301)->send();
            }
        }
    }