Make ApiService thread safe