public static bool ContainsBuilder(this IMoleculeBuildingBlock buildingBlock, IObjectBase entity)
        {
            if (!entity.CouldBeInMoleculeBuildingBlock())
            {
                return(false);
            }

            if (entity.IsAnImplementationOf <IMoleculeBuilder>())
            {
                return(buildingBlock.Contains((IMoleculeBuilder)entity));
            }

            if (entity.IsAnImplementationOf <ITransportBuilder>())
            {
                var transporterMoleculeContainers = buildingBlock.SelectMany(mb => mb.TransporterMoleculeContainerCollection);
                var allTransports = transporterMoleculeContainers.SelectMany(x => x.ActiveTransportRealizations);
                return(allTransports.Any(child => child.Equals(entity)));
            }

            var allChildren = buildingBlock.SelectMany(mb => mb.GetAllChildren <IEntity>());

            return(allChildren.Any(child => child.Equals(entity)));
        }
 public void Visit(IMoleculeBuildingBlock moleculeBuildingBlock)
 {
     _found = moleculeBuildingBlock.Contains(_entity);
 }