Optimize a function in the ItemSet Entity