public function getByAccessToken(AccessTokenEntity $accessToken)
    {
        $sql = <<<SQL
SELECT os.id, os.owner_type, os.owner_id, os.client_id, os.client_redirect_uri
FROM oauth_session os
INNER JOIN oauth_access_token oat ON(oat.session_id = os.id)
WHERE oat.access_token = :token
SQL;
        foreach ($this->getDbConnection()->fetchAll($sql, ['token' => $accessToken->getId()]) as $row) {
            if ($row) {
                return (new SessionEntity($this->server))
                    ->setId($row['id'])
                    ->setOwner($row['owner_type'], $row['owner_id']);
            }
        }
        return null;
    }