public IMessageEncoder Build(OutgoingMessage message) { var msgType = message.GetType(); if (_typeMap.TryGetValue(msgType, out var encoderType)) { return((IMessageEncoder)_container.GetInstance(encoderType)); } throw new Exception($"Encoder not found for {msgType.Name}"); }