def add(self, name, cfg, expand=False):
        """Add a configuration object.

        :param name: Name for later retrieval
        :param cfg: Configuration object
        :param expand: Flag for adding sub-configs for each sub-collection.
                       See discussion in method doc.
        :return: self, for chaining
        :raises: CreateQueryEngineError (only if expand=True)
        """
        self._d[name] = cfg
        if expand:
            self.expand(name)
        return self