Remove duplicated code in item.js