you may have better luck setting objects as relationships rather than the ids themselves. e.g. `new_audit.group = entity.group`. this allows sqla to manage the relationships for you so you don't need to flush to db / to create the ids etc.