Fix #29 - Encoding resources with contained resources caused the parent
resource to grow with each encode pass.