Refactor saved search API to make it thread safe