added methods to recover and save the item ids
added code to recover previous and current item ids