public static function create(array $content)
    {
        $access = static::arrayGet($content, 'access');
        $token = static::arrayGet($access, 'token');
        $tokenid = static::arrayGet($token, 'id');
        $expires = static::arrayGet($token, 'expires');

        try {
            $expireDate = new \DateTime($expires);
        } catch (\Exception $e) {
            throw new TokenException(sprintf('Invalid expiration date: %s', $e->getMessage()), null, $e);
        }

        $token = new static($tokenid, $expireDate);

        $catalogs = static::arrayGet($access, 'serviceCatalog');
        if (is_array($catalogs)) {
            foreach ($catalogs as $catalog) {
                $type = static::arrayGet($catalog, 'type');
                $name = static::arrayGet($catalog, 'name');
                $endpoints = static::arrayGet($catalog, 'endpoints');

                if (!is_array($endpoints)) {
                    throw new TokenException(sprintf('Invalid endpoints: %s', json_encode($endpoints)));
                }

                $token->addServiceCatalog($type, $name, $endpoints);
            }
        }

        return $token;
    }