RemoveDuplicatePatternAnyEntity = function(parsedContent, pEntityName, entityType, range) {
    // see if we already have this as Pattern.Any entity
    // see if we already have this in patternAny entity collection; if so, remove it but remember the roles (if any)
    let PAIdx = -1;
    let entityRoles = [];
    let PAEntityFound = parsedContent.LUISJsonStructure.patternAnyEntities.find(function(item, idx) {
        if(item.name === pEntityName) {
            PAIdx = idx;
            return true
        } else {
            return false;
        }
    });
    if (PAEntityFound !== undefined && PAIdx !== -1 && entityType != EntityTypeEnum.PATTERNANY) {
        if (entityType.toLowerCase().trim().includes('phraselist')) {
            let errorMsg = `Phrase lists cannot be used as an entity in a pattern "${pEntityName}"`;
            let error = BuildDiagnostic({
                message: errorMsg,
                range: range
            })
            throw (new exception(retCode.errorCode.INVALID_INPUT, error.toString(), [error]));
        } 
        entityRoles = (PAEntityFound.roles.length !== 0) ? PAEntityFound.roles : [];
        parsedContent.LUISJsonStructure.patternAnyEntities.splice(PAIdx, 1);
    }
    return entityRoles;
}
Helper function to remove duplicate pattern any definitions.
@param {Object} parsedContent Object containing current parsed content - LUIS, QnA, QnA alterations.
@param {String} pEntityName name of entity
@param {String} entityType type of entity
@param {String} range range