I have an ever growing switch case statement I plan on adding 3 more case statements to. Given an int, compare it to an enum, and call `IMapper.Map<TDestination>(sourceObject);`

```cs
public WebhookActivity MakeMessage(WebhookActivityRequest request)
{
    WebhookActivity command = _mapper.Map<ConsecutiveCaseCreated>(request);
    var mappingId = 0;
    for(int i = 0; i < mappings.Length; i++)
    {
        if(request.WorkflowCode == mappings[i].WorkflowCode)
        {
            mappingId = mappings[i].EventHandlerId;
        }
    }

    switch(mappingId)
    {
        case (int)WorkflowEventHandler.CONSECUTIVE_CASE_CREATED:
            {
                command = _mapper.Map<ConsecutiveCaseCreated>(request);
                break;
            }
        case (int)WorkflowEventHandler.CONSECUTIVE_CASE_MODIFIED:
            {
                command = _mapper.Map<ConsecutiveCaseModified>(request);
                break;
            }
        case (int)WorkflowEventHandler.CONSECUTIVE_CASE_CANCELLED:
            {
                command = _mapper.Map<ConsecutiveCaseCancelled>(request);
                break;
            }
        case (int)WorkflowEventHandler.INTERMITTENT_CASE_CREATED:
            {
                command = _mapper.Map<IntermittentCaseCreated>(request);
                break;
            }
        case (int)WorkflowEventHandler.INTERMITTENT_CASE_TIME_ADJUSTED:
            {
                command = _mapper.Map<IntermittentCaseTimeAdjusted>(request);
                break;
            }
        case (int)WorkflowEventHandler.INTERMITTENT_CASE_TIME_DELETED:
            {
                command = _mapper.Map<IntermittentCaseTimeDeleted>(request);
                break;
            }
        case (int)WorkflowEventHandler.CASE_CHANGED_TYPE:
            {
                command = _mapper.Map<CaseChangedType>(request);
                break;
            }
    }

    return command;
}

```

I looked at other enum related questions and saw a common solution of using a dictionary. I tried that and couldn't quite figure out how to make the call to IMapper.Map() work out. Made the code a lot smaller though! Here's what the dictionary based solution I came up with looks like and what the method code became.

```cs
private static readonly Dictionary<int, Type> workflowEventHandlers = new Dictionary<int, Type>
{
    { (int)WorkflowEventHandler.CONSECUTIVE_CASE_CREATED, typeof(ConsecutiveCaseCreated)},
    { (int)WorkflowEventHandler.CONSECUTIVE_CASE_CANCELLED, typeof(ConsecutiveCaseCancelled) },
    { (int)WorkflowEventHandler.CONSECUTIVE_CASE_MODIFIED, typeof(ConsecutiveCaseModified) },
    { (int)WorkflowEventHandler.INTERMITTENT_CASE_CREATED, typeof(IntermittentCaseCreated) },
    { (int)WorkflowEventHandler.INTERMITTENT_CASE_TIME_ADJUSTED, typeof(IntermittentCaseTimeAdjusted) },
    { (int)WorkflowEventHandler.INTERMITTENT_CASE_TIME_DELETED, typeof(IntermittentCaseTimeDeleted) },
    { (int)WorkflowEventHandler.CASE_CHANGED_TYPE, typeof(CaseChangedType) }
};

public WebhookActivity MakeMessage(WebhookActivityRequest request)
{
    WebhookActivity command = _mapper.Map<ConsecutiveCaseCreated>(request);
    var mappingId = 0;
    for(int i = 0; i < mappings.Length; i++)
    {
        if(request.WorkflowCode == mappings[i].WorkflowCode)
        {
            mappingId = mappings[i].EventHandlerId;
        }
    }

    if(workflowEventHandlers.TryGetValue(mappingId, out Type mapDestinationType))
    {
        //command = _mapper.Map(request, typeof(WebhookActivityRequest), mapDestinationType);
        //command = Map(request, mapDestinationType);
    }
}
// doesn't really work
private WebhookActivityMessage Map<TSource, TDestination>(TSource source, TDestination destination) where TDestination: WebhookActivityMessage
{
    return _mapper.Map<TSource, TDestination>(source);
}

```

The destination types all inherit from a base class called `WebhookActivityMessage` which inherits from `WebhookActivity` so I figured if I could say the return type of my Map() method was `WebhookActivityMessage` then it could be happy.