code: function rollbackTo(version) {
              var versions, rollbackCallback,
                  config = this.constructor.config,
                  snapshots = this.$$snapshots,
                  snapshotsLength = this.$$snapshots ? this.$$snapshots.length : 0;
  
              // if an invalid snapshot version was specified then don't attempt to do anything
              if (!angular.isArray(snapshots) || snapshotsLength === 0 || !angular.isNumber(version)) {
                  return false;
              }
  
              versions = snapshots.splice(Math.max(0, Math.min(version, snapshotsLength - 1)));
  
              if (!angular.isArray(versions) || versions.length === 0) {
                  return false;
              }
  
              rollbackCallback = versions[0].$rollbackCallback;
              angular.extend(this, (config.snapshotSerializer || config.serializer).deserialize(versions[0]));
  
              // restore special variables
              this.$$snapshots = snapshots;
              delete this.$rollbackCallback;
  
              if (angular.isFunction(rollbackCallback)) {
                  rollbackCallback.call(this);
              }
  
              return true;
          }
docs: Rolls back the resource to a specific snapshot version (0-based index).
  All versions after the specified version are removed from the snapshots list.
  
  If the version specified is greater than the number of versions then the last snapshot version
  will be used.  If the version is less than 0 then the resource will be rolled back to the first version.
  
  If no snapshots are available then the operation will return false.
  
  If a rollback callback function was defined then it will be called after the rollback has been completed
  with "this" assigned to the resource instance.
  
  @param {Number|undefined} version The version to roll back to.
  @returns {Boolean} true if rollback was successful, false otherwise