code: public IPromise atomicQuery(String key, RLFunction<Record,Object> action) {
          Record rec = getStore().get(key);
          if ( rec == null ) {
              final Object apply = action.apply(rec);
              if ( apply instanceof ChangeMessage )
              {
                  receive( (ChangeMessage) apply ) ;
              }
              return new Promise(apply);
          } else {
              PatchingRecord pr = new PatchingRecord(rec);
              final Object res = action.apply(pr);
              if ( res instanceof ChangeMessage )
              {
                  receive( (ChangeMessage) res ) ;
              } else {
                  UpdateMessage updates = pr.getUpdates(0);
                  if (updates != null) {
                      receive(updates);
                  }
              }
              return new Promise(res);
          }
      }
docs: apply the function to the record with given key and return the result inside a promise
  
  changes to the record inside the function are applied to the real record and a change message
  is generated.
  
  In case the function returns a changemessage (add,putRecord,remove ..), the change message is applied
  to the original record and the change is broadcasted
  
  @param key
  @param action
  @return the result of function.