public static BehaviorsDisposable <IEnumerable <T> > AddBehavior <T>
 (
     this IEnumerable <T> collection,
     DoForEachItemCollectionBehavior <T> behavior
 )
 {
     return(collection.AddBehaviorImpl <T>(behavior));
 }
        private static BehaviorsDisposable <IEnumerable <T> > AddBehaviorImpl <T>
        (
            this IEnumerable <T> collection,
            Action <T> onAdd,
            Action <T> onRemove = null,
            BehaviorsDisposable <IEnumerable <T> > previousBehavior = null
        )
        {
            DoForEachItemCollectionBehavior <T> behavior = new DoForEachItemCollectionBehavior <T>(onAdd, onRemove);

            return(collection?.AddBehaviorImpl <T>(behavior, previousBehavior));
        }
        private static BehaviorsDisposable <IEnumerable <T> > AddBehaviorImpl <T>
        (
            this IEnumerable <T> collection,
            DoForEachItemCollectionBehavior <T> behavior,
            BehaviorsDisposable <IEnumerable <T> > previousBehavior = null
        )
        {
            if (collection == null)
            {
                return(null);
            }

            DisposableBehaviorContainer <IEnumerable <T> > behaviorContainer =
                new DisposableBehaviorContainer <IEnumerable <T> >(behavior, collection);

            BehaviorsDisposable <IEnumerable <T> > behaviorsDisposable =
                new BehaviorsDisposable <IEnumerable <T> >(behaviorContainer, previousBehavior);

            return(behaviorsDisposable);
        }