Converted some functions in ItemData model to use query API from SQLAlchemy.