failure: function (results) {
     alerts.show($scope, {
         type: alerts.type.error,
         msg: 'Failed to rename',
         withApply: true
     });
 }
        $scope.rename = function () {
            $scope.renameBtn.disabled = true;
            alerts.show($scope, {
                type: alerts.type.info,
                msg: 'Renaming tags'
            });

            tagGroupRepo.rename(_.toLowerCase($scope.oldTags), _.toLowerCase($scope.newTags), {
                success: function () {
                    $scope.oldTags = [];
                    $scope.newTags = [];
                    alerts.show($scope, {
                        type: alerts.type.success,
                        msg: 'Renamed successfully',
                        hideAfterward: true
                    });
                    $scope.$apply();
                },
                failure: function (results) {
                    alerts.show($scope, {
                        type: alerts.type.error,
                        msg: 'Failed to rename',
                        withApply: true
                    });
                }
            })
        };
 success: function () {
     $scope.oldTags = [];
     $scope.newTags = [];
     alerts.show($scope, {
         type: alerts.type.success,
         msg: 'Renamed successfully',
         hideAfterward: true
     });
     $scope.$apply();
 },