split entity logic to seperate module