public function getCurrentTopOrganizationId()
    {
        $userLoader = $this->loader->getUserLoader();

        // Url determines organization first.
        if ($orgId = $userLoader->getOrganizationIdByUrl()) {
            $this->_organizationFromUrl = true;
            return ' ';
        }

        $request = $this->getRequest();
        if ($request->isPost() && ($orgId = $request->getParam($this->topOrganizationFieldName))) {
            \Gems_Cookies::set('gems_toporganization', $orgId);
            return $orgId;
        } else {
            $orgs = array_keys($this->getTopOrganizations());
            $firstId = reset($orgs);
            return \Gems_Cookies::get($this->getRequest(), 'gems_toporganization', $firstId);
        }
    }