Added a function to only serialize given keys

Its pretty useful for large models where you only need to send few values over network i.e. primaryKeys