Repair referenced sequences on tables

Lately I had to repair one interesting problem. One colleague created staging schema and copied existing table structures but did not change sequences referenced in default values for IDs. So I had to repair it. I also had to set properly current value of staging...