Merge "Add captureLayers function to capture a layer and its children."