Introduce recursive array filter to the publish function