Fixed a bug where in certain situations duplicated data records are created upon updating an entity