create and remove nested objects in jquery