title: Converting a list of items to a single object
body: <p>I need to convert a list of items to a single dto item. In case there are any elements in the list, we take the first one.
  I implemented the converter interface this way, but it doesn't work. The destination item is null after the conversion.</p>
  
  <pre><code>public class LocationConverter implements Converter&lt;List&lt;Location&gt;,LocationDto&gt; {
  
  @Override
  public LocationDto convert(MappingContext&lt;List&lt;Location&gt;, LocationDto&gt; mappingContext) {
      ModelMapper modelMapper = new ModelMapper();
      List&lt;Location&gt; locations = mappingContext.getSource();
      LocationDto locationDto = mappingContext.getDestination();
      if (locations.size() &gt;= 1) {
          Location location = locations.get(0);
          modelMapper.map(location, locationDto);
          return locationDto;
      }
      return null;
     }
  }
  
   ModelMapper modelMapper = new ModelMapper();
   modelMapper.addConverter(new LocationConverter());
   Event event = new Event();
   modelMapper.map(event, eventDto);
  </code></pre>
  
  <p>The entities on which I apply this converter look so:</p>
  
  <pre><code>public class Event extends BasicEntity  {
  
    private Integer typeId;
  
    private String typeName;
  
    private List&lt;Location&gt; locationList;
  
  }
  
  
  public class EventDto {
  
      private Integer typeId;
  
     private String typeName;
  
     private LocationDto location;
  }
  </code></pre>
  
  <p>So I need the list of locations in Event to be converted into LocationDto in EventDto.</p>