write a common entity constructor