App.VariantsIndexController = Ember.ObjectController.extend({
    remove: function( variant ) {
        var things = variant,
            that = this,
            mobileVariantPipe = AeroGear.Pipeline({
            name: "mobileVariant",
            settings: {
                baseURL: "/ag-push/rest/applications/",
                authenticator: App.AeroGear.authenticator,
                endpoint:  variant.pushApplicationID + "/" + variant.get( "type" )
            }
        }).pipes.mobileVariant;

        mobileVariantPipe.remove( variant.variantID, {
            success: function() {
                var content = that.get("variantList"),
                    find;

                find = content.find( function( value ) {
                    return value.variantID === things.variantID;
                });

                content.removeObject( find );
            },
            error: function( error ) { // TODO: Maybe Make this a class method?
                console.log( "error with application endpoint", error );
                switch( error.status ) {
                case 401:
                    App.Router.router.transitionToRoute("login");
                    break;
                default:
                    //that.transitionToRoute( "login" );
                    //result.setProperties( { isLoaded: true, error: error } );
                    break;
                }
            }
        });
    },
    add: function( controller ) {
        var applicationData = {
            name: controller.get( "variantName" ),
            description: controller.get( "variantDescription" )
        },
        applicationPushId = controller.get( "pushApplicationID" ),
        variantType =  $( "input:checked" ).val();

        if( variantType ) {
            switch( variantType ) {
            case "android":
                applicationData.googleKey = controller.get( "googleKey" ); //Needs Validation Here
                break;
            case "iOS":
                applicationData.passphrase = controller.get( "passphrase" );
                break;
            case "simplePush":
                applicationData.pushNetworkURL = controller.get( "pushNetworkURL" );
                break;
            default:
                break;
            }
        }

        this.saveMobileVariant( applicationData, variantType, applicationPushId  );
    },
    saveMobileVariant: function( applicationData, variantType, applicationPushId ) {
        var mobileVariantPipe = AeroGear.Pipeline({
            name: "mobileVariant",
            settings: {
                baseURL: "/ag-push/rest/applications/",
                authenticator: App.AeroGear.authenticator,
                endpoint:  applicationPushId + "/" + variantType
            }
        }).pipes.mobileVariant,
        that = this;

        mobileVariantPipe.save( applicationData, {
            success: function() {
                that.transitionToRoute( "variants", that.get( "model" ) );
            },
            error: function( error ) {
                console.log( "error saving", error );
                switch( error.status ) {
                case 401:
                    that.transitionToRoute( "login" );
                    break;
                default:
                    break;
                }
            }
        });
    },
    cancel: function( controller ) {
        //Probably a better way
        controller.set( "name", "" );
        controller.set( "description", "" );

        this.transitionToRoute( "mobileApps" );
    }
});

App.VariantsAddController = Ember.ObjectController.extend({
    needs: "variantsIndex"
});

@@ -1474,16 +1474,41 @@
     var 
+that = this,%0A            
 applicat
@@ -1519,16 +1519,20 @@
 ata = %7B%0A
+    
         
@@ -1586,16 +1586,20 @@
         
+ 
+   
 descript
@@ -1642,32 +1642,36 @@
 tion%22 )%0A        
+    
 %7D,%0A        appli
@@ -1657,32 +1657,36 @@
      %7D,%0A        
+ 
+   
 applicationPushI
@@ -1724,24 +1724,28 @@
 ationID%22 ),%0A
+    
         vari
@@ -1781,16 +1781,210 @@
  ).val()
+,%0A            url = %22/ag-push/rest/applications/%22 + applicationPushId + %22/%22 + variantType,%0A            type = %22POST%22,%0A            contentType = %22application/json%22,%0A            dataType =  %22json%22
 ;%0A%0A     
@@ -2289,24 +2289,77 @@
 sphrase%22 );%0A
+                // TODO: need to get the certificate%0A
             
@@ -2589,585 +2589,260 @@
     
-this.saveMobileVariant( applicationData, variantType, applicationPushId  );%0A    %7D,%0A    saveMobileVariant: function( applicationData, variantType, applicationPushId ) %7B%0A        var mobileVariantPipe = AeroGear.Pipeline(%7B%0A            name: %22mobileVariant%22,%0A            settings: %7B%0A                baseURL: %22/ag-push/rest/applications/%22,%0A                authenticator: App.AeroGear.authenticator,%0A                endpoint:  applicationPushId + %22/%22 + variantType%0A            %7D%0A        %7D).pipes.mobileVariant,%0A        that = this;%0A%0A        mobileVariantPipe.save( applicationData, %7B
+// TODO: use aerogear pipes once we get multi part support%0A        $.ajax(%7B%0A            %22url%22: url,%0A            %22type%22: type,%0A            %22contentType%22: contentType,%0A            data: JSON.stringify( applicationData ),%0A            %22dataType%22: dataType,
 %0A   
@@ -3497,17 +3497,15 @@
 e( %22
-mobileApp
+variant
 s%22 )

save variant with $.ajax.. for now