Add ReplaceSeries and refactor the CreateSeries function into smaller steps

You're converting public keys here. There's also a very similar function in my pull request.