adding serialization method for models