public function getBySession(SessionEntity $session)
    {
        foreach($this->getDbConnection()->fetchAll(
            'SELECT oc.id, oc.name FROM oauth_client oc
            INNER JOIN oauth_session os ON(oc.id = os.client_id)
            WHERE os.id = :id',
            ['id' => $session->getId()]
        ) as $row) {
            if ($row) {
                return (new ClientEntity($this->server))
                    ->hydrate([
                        'id' => $row['id'],
                        'name' => $row['name']
                    ]);
            }
        }
        return null;
    }