handleAtPrefix = function(entity, flatEntityAndRoles) {
    if (entity.entity.match(/^@/g)) {
        entity.entity = entity.entity.replace(/^@/g, '').trim();
        if (flatEntityAndRoles) {
            // find the entity as a match by name
            let entityMatch = flatEntityAndRoles.find(item => item.entityName == entity.entity);
            if (entityMatch !== undefined) {
                return entity;
            }
            // find the entity as a match by role
            let roleMatch = flatEntityAndRoles.find(item => item.roles.includes(entity.entity));
            if (roleMatch !== undefined) {
                // we have a role match. 
                entity.role = entity.entity;
                entity.entity = roleMatch.name;
                return entity;
            }
        }
    }
    
    return entity;
}
Helper function to handle @ entity or @ role reference in utterances.
@param {Object} entity 
@param {Object []} flatEntityAndRoles