Generate works model and its relations