addItemOrRoleIfNotPresent = function (collection, type, value, roles) {
    let existingItem = collection[type].filter(item => item.name == value);
    if (existingItem.length !== 0) {
        // see if the role exists and if so, merge
        if (existingItem[0].roles === undefined) {
            existingItem[0].roles = [];
        }

        mergeRoles(existingItem[0].roles, roles);
    } else {
        let itemObj = {};
        itemObj.name = value;
        if (type == LUISObjNameEnum.PATTERNANYENTITY) {
            itemObj.explicitList = [];
        }
        if (type !== LUISObjNameEnum.INTENT) {
            itemObj.roles = roles;
        }
        collection[type].push(itemObj);
    }
}
Helper function to add an item to collection if it does not exist
@param {object} collection contents of the current collection
@param {LUISObjNameEnum} type item type
@param {object} value value of the current item to examine and add
@param {string []} roles possible roles to add to the item
@returns {void} nothing