NSCoding-like API to save objects into database