title: Room getting ConcurrentModificationException
body: <p>I am facing an issue while inserting data to Android table. Here is my Dao functions:</p>
  
  <pre><code>@Insert(onConflict = OnConflictStrategy.REPLACE)
  fun insert(freight: Foo)
  
  @Insert(onConflict = OnConflictStrategy.REPLACE)
  fun insert(freights: MutableList&lt;Foo&gt;)
  </code></pre>
  
  <p>Here is how it is invoke:</p>
  
  <pre><code>  Observable.fromCallable {
            db.fooDao().insert(it)
         }
      }
              .subscribeOn(Schedulers.io())
              .observeOn(Schedulers.io())
              .subscribe {
                  Logger.d("Inserted ${it} users from API in DB...")
              }
  </code></pre>
  
  <p>Exception I am getting:</p>
  
  <pre><code>   Caused by: java.util.ConcurrentModificationException
      at java.util.ArrayList$Itr.next(ArrayList.java:860)
      at com.blockgrain.blockgrain.dbmanager.repository.FooRepository$insertDataInDb$1.call(FooRepository.kt:76)
  </code></pre>
  
  <p>I have created other tables with same logic they are working fine but this one is failing . Please let me know what went wrong.</p>
  
  <p><strong>Update</strong> :</p>
  
  <p>Foo.kt</p>
  
  <pre><code> override fun get(): Observable&lt;MutableList&lt;Foo&gt;&gt; {
      val observable = getDataFromDb()
      return observable.flatMap {
          if (it.isEmpty())
              getDataFromApi()
          else
              observable
      }
  }
  
  override fun getDataFromApi(): Observable&lt;MutableList&lt;Foo&gt;&gt; {
  
      return WebService.createWithAuth().getFooFromWeb()
              .doOnNext {
                  Logger.d(" Dispatching ${it} users from API...")
                  Observable.fromCallable {
                       db.fooDao().insert(it)
                        }
                    }
                    .subscribeOn(Schedulers.io())
                    .observeOn(Schedulers.io())
                    .subscribe {
                             Logger.d("Inserted ${it} users from API in DB...")
                    }
                 }
  }
  </code></pre>