title: IBM Worklight - JSONStore logic to refresh data from the server and be able to work offline
body: <p>currently the JSONStore API provides a load() method that says in the documentation:</p>
  
  <blockquote>
    <p>This function always stores whatever it gets back from the adapter. If
    the data exists, it is duplicated in the collection". This means that
    if you want to avoid duplicates by calling load() on an already
    populated collection, you need to empty or drop the collection before.
    But if you want to be able to keep the elements you already have in
    the collection in case there is no more connectivity and your
    application goes for offline mode, you also need to keep track of
    these existing elements.</p>
  </blockquote>
  
  <p>Since the API doesn't provide a "overwrite" option that would replace the existing elements in case the call to the adapter succeeds, I'm wondering what kind of logic should be put in place in order to manage both offline availability of data and capability to refresh at any time? It is not that obvious to manage all the failure cases by nesting the JS code due to the promises...</p>
  
  <p>Thanks for your advices!</p>