refactored mock api to persist items