import Ember from 'ember';

export default Ember.ObjectController.extend(Ember.I18n.TranslateableProperties, {
  proxiedObjectives: [],
  session: null,
  course: null,
  actions: {
    addParent: function(parentProxy){
      var newParent = parentProxy.get('content');
      var self = this;
      var sessionObjective = this.get('model');
      sessionObjective.get('parents').then(function(ourParents){
        newParent.get('children').then(function(newParentChildren){
          newParentChildren.addObject(sessionObjective);
          newParent.save().then(function(newParent){
            ourParents.addObject(newParent);
            sessionObjective.save().then(function(sessionObjective){
              self.set('model', sessionObjective);
            });
          });
        });
      });
    },
    removeParent: function(parentProxy){
      var self = this;
      var removingParent = parentProxy.get('content');
      var sessionObjective = this.get('model');
      sessionObjective.get('parents').then(function(ourParents){
        ourParents.removeObject(removingParent);
        removingParent.get('children').then(function(children){
          children.addObject(sessionObjective);
          sessionObjective.save().then(function(sessionObjective){
            self.set('model', sessionObjective);
            removingParent.save();
          });
        });
      });
    }
  }
});

@@ -263,39 +263,16 @@
 tent');%0A
-      var self = this;%0A
       va
@@ -303,32 +303,32 @@
 s.get('model');%0A
+
       sessionObj
@@ -368,32 +368,73 @@
 on(ourParents)%7B%0A
+        ourParents.addObject(newParent);%0A
         newParen
@@ -572,78 +572,8 @@
 ve()
-.then(function(newParent)%7B%0A            ourParents.addObject(newParent)
 ;%0A  
@@ -572,34 +572,32 @@
 ve();%0A          
-  
 sessionObjective
@@ -607,121 +607,8 @@
 ve()
-.then(function(sessionObjective)%7B%0A              self.set('model', sessionObjective);%0A            %7D);%0A          %7D)
 ;%0A  
@@ -679,31 +679,8 @@
 y)%7B%0A
-      var self = this;%0A
     
@@ -967,35 +967,38 @@
        children.
-add
+remove
 Object(sessionOb
@@ -1021,160 +1021,63 @@
     
-sessionObjective.save().then(function(sessionObjective)%7B%0A            self.set('model', sessionObjective);%0A            removingParent.save();%0A          %7D
+removingParent.save();%0A          sessionObjective.save(
 );%0A 

Fix issue with removing parent and speed up the process