Your feeling is correct. It would be wrong to do it with 2 accesses to the DB because you may end up with inconsistent results because the data might be modified between the 2 accesses.
I am not sure how you could do that but you might want to experiment with
or