There is another question often asked, concerning how to immediatly avoid duplicated record in the same block. (by immediatly I would say before posting or committing).
The technique used to solve this problem comes from the Kevin D Clarke’s calculated item famous solution.