code: function createResource(url, params, methods) {
        var resource;
  
        params = _.defaults({}, params, defaultParams);
        methods = _.defaults({}, methods, defaultMethods);
        resource = $resource(url, params, methods);
  
        // overwrite $save to automatically call $create or $update
        resource.prototype.$save = function save() {
          if (!this._id) {
            return this.$create();
          }
  
          return this.$update();
        };
  
        return resource;
      }
docs: Create a resource with overwritten $save method
  
  @param url
  @param params
  @param methods
  @returns {$resource}