code: function(options) {
        options = options ? langx.clone(options) : {};
        var entity = this;
        var success = options.success;
        var wait = options.wait;
  
        var destroy = function() {
          entity.stopListening();
          entity.trigger('destroy', entity, entity.collection, options);
        };
  
        options.success = function(resp) {
          if (wait) destroy();
          if (success) success.call(options.context, entity, resp, options);
          if (!entity.isNew()) entity.trigger('sync', entity, resp, options);
        };
  
        var xhr = false;
        if (this.isNew()) {
          langx.defer(options.success);
        } else {
          wrapError(this, options);
          xhr = this.sync('delete', this, options);
        }
        if (!wait) destroy();
        return xhr;
      }
docs: Destroy this entity on the server if it was already persisted. Optimistically removes the entity from its collection, if it has one. If `wait: true` is passed, waits for the server to respond before removal.