write entities, writing DAL