added logic to process new db structure with separate entities for faculty, group, subjects and teachers