Select id from assets first to decide if insert or update