code: function() {
        return this.$action(function() {
          var url = this.$url('destroy');
          if(url)
          {
            var request = { method: 'DELETE', url: url };
  
            this
              .$dispatch('before-destroy', [request])
              .$send(request, function(_response) {
  
                // remove from scope
                if(this.$scope.$remove) {
                  this.$scope.$remove(this);
                }
  
                this.$dispatch('after-destroy', [_response]);
              }, function(_response) {
                this.$dispatch('after-destroy-error', [_response]);
              });
          }
          else
          {
            // If not yet bound, just remove from parent
            if(this.$scope.$remove) this.$scope.$remove(this);
          }
        });
      }
docs: @memberof RecordApi#
  
  @description Begin a server request to destroy the resource.
  
  The request's promise can be accessed using the `$asPromise` method.
  
  @return {RecordApi} this