Protecting the rights of children in the legal system