added check to begin entity transaction