private static IEnumerable<Type> ResolveMessageHandlerInterface(Type type)
{
return type
.GetInterfaces()
.Where(i => i.GetTypeInfo().IsGenericType && ((i.GetGenericTypeDefinition() == typeof(ICommandHandler<>))
|| i.GetGenericTypeDefinition() == typeof(IEventHandler<>)));
}