public async Task <ActionResult <SendMessageModel> > SendMessage(string handler) { INotificationHandler notificationHandler = notificationHandlerService.GetHandler(handler); if (notificationHandler == null) { return(NotFound()); } Dictionary <string, string> defaultValues = configuration.GetSection($"Handlers:{notificationHandler.Name}").Get <Dictionary <string, string> >(); if (defaultValues == null) { return(StatusCode(StatusCodes.Status500InternalServerError)); } IMessage messageToSend = messageParseService.Parse(notificationHandler.GetMessageType(), Request.Form, defaultValues); if (messageToSend == null) { return(StatusCode(StatusCodes.Status500InternalServerError)); } Tuple <bool, string> result = await notificationHandler.SendMessage(messageToSend); return(Ok(new SendMessageModel { Result = result.Item1, ErrorMessage = result.Item2 })); }