I have entity1. Request dto of that entity has field entity2Id. Entity1 instead of request dto entity2Id field contains entity2 field, which should store entity2 type info. I have main service layer and additional dto layer(which my main service use for mapping from request dto to entity and conversely). So, when my dto layer maps entity1 dto to entity1 it has one additional task - to find entity2 by id value and set it to the entity. But, i've heard that it shouldn't be done inside dto service layer. Ok, i can return partly filled entity from dto service, and fill it and finally set entity2 field in my main service. But, in this case my dto service will be not fully functional, because it sets only part of all fields.
Help me please, how and where i should realize this logic - dto service layer or main service layer(in my case service layer is service that takes request dto from request, maps it using dto service to entity, make some action with repository and returns response dto using same dto service)?