split out entity_mapper code to own module