query all items form database
resolve some conflicts