this should be done via bulk load to avoid excessive DB round trips. probably worth making a utility function somewhere.