def _add_param(name, value, result, param_appearance_counters):
    """Add a parameter to the parse result dictionary.

    If the parameter name already exists in the dictionary then a counter
    is appended - e.g. myparam-2, myparam-3 etc.

    Arguments:
    name - The name of the parameter to add
    value - The value of the parameter to add
    result - The parse result dictionary to add the parameter to.
    param_appearance_counters - Dictionary that tracks how many times parameter
                                names have already been used.

    Returns:
    The unique name used in the dictionary for the param. Will be the name
    specified in the call to the function unless that name already existed in
    the dictionary, in which case it will have an incrementing number appended.
    """
    if name not in result:
        param_appearance_counters[name] = 1
        unique_name = name
    else:
        # Param name already exists - append a counter
        param_appearance_counters[name] += 1
        unique_name = '{0}-{1}'.format(name, param_appearance_counters[name])
    result[unique_name] = value
    return unique_name