Fixed the entity and Dai interface generators

Fixed bugs related to restructuring of code into a more generic and
readable code