I bit late but this might point you in the right direction.
You'll will need to look into the new Link OS SDK for the ZC range of printers to allow you to perform magnetic encoding as I don't believe the method your using will work with any of the current range of printers. I may be wrong but I've not used that method since the old Zebra P430i
If you're using visual studio you can get a Nuget package by looking for 'Zebra.Printer.Card.SDK' I'd still download a copy as the package hasn't updated yet and the SDK on the Zebra site is slightly newer plus you'll get some demo code and the manuals. You'll also need to use using at minimum Visual Studio 2015 as the SDK is now based on .Net 4.7 so no XP, Vista or Server 2008 support.
You've got two methods of encoding, with or without print. If you want to keep your current printing system using the spooler then I'd suggest you use the MagEncode function that's building to the Zebra.Sdk.Card.Printer.ZebraPrinterZmotif class. But you'll need to make sure that the printdocument has the already in printer option set as you'll need to leave the card in the 'hold position' or 'internal'.
It's not a straight forward process I had the benefit of using the ZMotif system for the ZXP 7 - 9 printers so most of my code was already in place and I just needed to switch to the new sdk so I had it working in an afternoon.
Put it this way the two lines that we used to use for mag encoding will now have to be a few hundred.