A former elementary school teacher from New Jersey admitted Tuesday that he made a music video out of child pornography he created by hiding a camera in restrooms at a summer theater camp and recording underage boys.

Thomas Guzzi Jr., 39, pleaded guilty in Gloucester County to official misconduct, manufacturing child pornography, and the distribution of 25 or more files of child pornography, the state’s attorney general, Gurbir S. Grewal, announced on Tuesday.

Guzzi, a former fifth-grade teacher, admitted that he hid cameras in the restroom of a summer theater camp to record teen boys urinating in Pitman, New Jersey in 2015.

Guzzi said that he created a music video by splicing together one of those videos and recordings of the same boy dancing in rehearsals for the summer musical production. Guzzi also said he took a photo of a boy’s genitals while employed as a teacher at another summer program. The nude photos and video recordings used in the music video and other photo montages made by the ex-teacher were taken from about three hours of restroom footage recorded during the summer camp program, the attorney general’s office said.

Guzzi was first arrested in 2016 during a child pornography sweep by Grewal’s office, state police, and Homeland Security Investigations, when authorities executed a search warrant at his home and found more than 300 files of child pornography on his computers. Investigators said they found him by tracing child porn back to his computer’s IP address.

After his arrest, Guzzi was fired by Winslow Elementary School and his teaching license was revoked, according to the attorney general’s office.

“Like many child predators, Guzzi sought out positions of trust in which children were placed under his supervision,” said Grewal, in a press release.

“He then callously violated that trust by photographing and videotaping young boys for his sexual gratification, including a vulnerable student at a school where he taught. With this guilty plea, Guzzi is facing justice for so heinously betraying the innocent children who were entrusted to his care,” he added.

The state will recommend that Guzzi receive a sentence of 17 years in prison and that he must serve 10 years before he becomes eligible for parole. Guzzi’s plea agreement will require him to register as a sex offender and undergo parole supervision for the rest of his life.

He will be sentenced on Sept. 27.