. . . "Does it work if the entity is not detached e.g. can you replicate this in a unit test?" .