def userdata_to_db(session, method='update', autocommit=False):
    """
    Add catchments from a user folder to the database.

    The user folder is specified in the ``config.ini`` file like this::

        [import]
        folder = path/to/import/folder

    If this configuration key does not exist this will be silently ignored.

    :param session: database session to use, typically `floodestimation.db.Session()`
    :type session: :class:`sqlalchemy.orm.session.Session`
    :param method: - ``create``: only new catchments will be loaded, it must not already exist in the database.
                   - ``update``: any existing catchment in the database will be updated. Otherwise it will be created.
    :type method: str
    :param autocommit: Whether to commit the database session immediately. Default: ``False``.
    :type autocommit: bool
    """

    try:
        folder = config['import']['folder']
    except KeyError:
        return
    if folder:
        folder_to_db(folder, session, method=method, autocommit=autocommit)