Implementation of __sleep for models