Improving entity logging and restoring