You should have found Create and Update functions where you found your existing script ?
If not see here for ideas