title: Sugar ORM is not saving data into the database
body: <p>I am currently using <a href="https://github.com/satyan/sugar" rel="noreferrer">Sugar ORM</a> and <a href="http://loopj.com/android-async-http/" rel="noreferrer">Android Async Http Client</a> for my Android application. </p>
  
  <p>I read through the documentation of Sugar ORM and did exactly what is written there.
  My HttpClient is using the singleton pattern and provides methods for calling some APIs. </p>
  
  <p>Now comes the bad part about it. I am not able to save the data persistently into my database which is created by Sugar ORM. 
  Here is the method, that is calling an API:</p>
  
  <pre><code>public void getAvailableMarkets(final Context context, final MarketAdapter adapter) {
          String url = BASE_URL.concat("/markets.json");
          client.addHeader("Content-Type", "application/json");
          client.addHeader("Accept", "application/json");
  
          client.get(context, url, null, new JsonHttpResponseHandler() {
  
              @Override
              public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
  
                  Log.i(TAG, "Fetched available markets from server: " + response.toString());
  
  
                  Result&lt;Markets&gt; productResult = new Result&lt;Markets&gt;();
                  productResult.setResults(new Gson().&lt;ArrayList&lt;Markets&gt;&gt;fromJson(response.toString(),
                          new TypeToken&lt;ArrayList&lt;Markets&gt;&gt;() {
                          }.getType()));
                  ArrayList&lt;Markets&gt; marketsArrayList = productResult.getResults();
  
                  // This lines tells me that there are no entries in the database
                  List&lt;Markets&gt; marketsInDb = Markets.listAll(Markets.class);
  
                  if(marketsInDb.size() &lt; marketsArrayList.size() ||
                          marketsInDb.size() &gt; marketsArrayList.size()) {
  
                      Markets.deleteAll(Markets.class);
  
                      for(Markets m : marketsArrayList) {
                          Markets market = new Markets(m.getId(), m.getName(), m.getChainId(), m.getLat(),
                                  m.getLng(), m.getBusinessHourId(), m.getCountry(), m.getZip(), m.getCity(),
                                  m.getStreet(), m.getPhoto(), m.getIcon(), m.getUrl());
  
                          market.save();
  
                          adapter.add(market);
                      }
  
                      adapter.notifyDataSetChanged();
  
                  } 
  
                  List&lt;Markets&gt; market = Markets.listAll(Markets.class);
                  // This lines proves that Sugar ORM is not saving the entries   
                  Log.i(TAG, "The market database list has the size of:" + market.size());
              }
          });
      }
  </code></pre>
  
  <p>This is what Logcat is printing:</p>
  
  <pre><code>D/Sugar: Fetching properties
  I/Sugar: Markets saved : 3
  I/Sugar: Markets saved : 5
  I/RestClient: The market database list has the size of:0
  </code></pre>
  
  <p>Also I took a look at the Sugar ORM tag here at stackoverflow, but no answers or questions could give me a hint on how to solve that problem.
  I am a newbie to the android ecosystem and would love any help of you guys to solve this problem. 
  Thanks in advance</p>