private function assertProperties($doc, $required, $method)
    {
        $keys = array_keys($doc);
        $diff = array_diff($required, $keys);

        if (empty($diff)) {
            return;
        }

        $err = $method . ': the following required properties are missing: ';
        $err .= implode(', ', $diff);
        throw new InvalidArgumentException($err);
    }