fixed model mapping, refactoring the processing of apiMap and modelMap so it's executed just once