public async ValueTask <IActionResult> SendEmail(PostSendEmailCommandInput command, [FromServices] NotificationHandler handler)
        {
            try
            {
                var result = await handler.Handle(command);

                return(GetResult(result));
            }
            catch (Exception exception)
            {
                _logger.LogError("An exception has occurred at {dateTime}. " +
                                 "Exception message: {message}." +
                                 "Exception Trace: {trace}", DateTime.UtcNow, exception.Message, exception.StackTrace);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
        public async ValueTask <GenericCommandResult> Handle(PostSendEmailCommandInput command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "Incorrect  data!", null, StatusCodes.Status400BadRequest, command.Notifications));
            }

            bool sendEmail = await _sendGridService.SendEmail(command.To, command.From, command.FromName, command.Subject, command.Message);

            if (!sendEmail)
            {
                return(new GenericCommandResult(false, "It was not possible to send your email !", null, StatusCodes.Status403Forbidden, command.Notifications));
            }


            return(new GenericCommandResult(true, "Your email sent successfully!", null, StatusCodes.Status200OK, command.Notifications));
        }