define(["underscore"],function(a){return{applyMixin:function(){a.bindAll(this,"destroyAllControllers","destroyAllViews","destroy")},destroyAllControllers:function(){a.each(this.ctrls,function(a){a&&a.destroy&&(a.isClosed=!0,a=componentUtils.destroy(a))},this),this.ctrls={}},destroyAllViews:function(){a.each(this.views,function(a){a&&a.destroy&&(a=componentUtils.destroy(a))},this),this.views={}},destroy:function(){this.eventManager&&this.eventManager.removeKeyVisible(this.cid),this._unbindEvents&&this._unbindEvents(),this.destroyAllControllers(),this.destroyAllViews(),this.views.layoutView&&this.views.layoutView.destroy(),Marionette.Controller.prototype.destroy.apply(this,arguments)}}});