code: function () {
            var self = this;
            var ref = self.$ref();
            var def = $q.defer();
            var dataJSON;
  
            try {
              dataJSON = $firebaseUtils.toJSON(self);
            } catch (e) {
              def.reject(e);
            }
  
            if (typeof dataJSON !== 'undefined') {
              $firebaseUtils.doSet(ref, dataJSON).then(function() {
                self.$$notify();
                def.resolve(self.$ref());
              }).catch(def.reject);
            }
  
            return def.promise;
          }
docs: Saves all data on the FirebaseObject back to Firebase.
  @returns a promise which will resolve after the save is completed.