first write to the datastore