Refactoring the handling of entity definition files.

Signed-off-by: Kristian Duske <kristian.duske@gmail.com>