Saving an instance of the object into the shared preferences