         controller: ($scope) ->
             _rollbackStorage = {}
 
-            getIdx = (block) ->
-                return _.indexOf $scope.blocks, block
-
             updateMovementToggles = ->
                 _.each $scope.blocks, (b, idx) ->
                     b.canMoveUp = idx > 0


            this.editBlock = (block) ->
                _rollbackStorage[block.$$hashKey] = _.cloneDeep block
                $scope.blocks[getIdx(block)].editing = yes

            this.submitBlockEdit = (block) ->
                block = $scope.blocks[getIdx block]
                block.saved = yes
                block.editing = no

            this.rollbackBlockEdit = (block) ->
                block = $scope.blocks[getIdx block]

                # If block wasn't previously saved, delete it right away
                if not block.saved


            this.moveDown = (block) ->
                if block.canMoveDown
                    index = _.indexOf $scope.blocks, block

                    if index < $scope.blocks.length - 1
                        current = $scope.blocks[index]
