public static PersistenceSpecification <T> CheckInverseBag <T, TListElement>(this PersistenceSpecification <T> spec,
                                                                                     Expression <Func <T, IEnumerable <TListElement> > > expression,
                                                                                     IEnumerable <TListElement> propertyValue,
                                                                                     IEqualityComparer elementComparer)
        {
            Accessor property = ReflectionHelper.GetAccessor(expression);

            return(spec.RegisterCheckedPropertyWithoutTransactionalSave(new ReferenceBag <T, TListElement>(property, propertyValue), elementComparer));
        }
        public static PersistenceSpecification <T> CheckInverseBag <T, TListElement>(this PersistenceSpecification <T> spec,
                                                                                     Expression <Func <T, IEnumerable <TListElement> > > expression,
                                                                                     IEnumerable <TListElement> propertyValue,
                                                                                     IEqualityComparer elementComparer,
                                                                                     Action <T, TListElement> listItemSetter)
        {
            Accessor property = ReflectionHelper.GetAccessor(expression);

            var list = new ReferenceBag <T, TListElement>(property, propertyValue);

            list.ValueSetter = (target, propertyInfo, value) =>
            {
                foreach (var item in value)
                {
                    listItemSetter(target, item);
                }
            };

            return(spec.RegisterCheckedPropertyWithoutTransactionalSave(list, elementComparer));
        }