public async Task <User> InsertAsync(User user)
        {
            _logger.LogDebug($"User {_authenticatedService.GetUserKey()} is starting {nameof(UserService)}.{nameof(InsertAsync)}");

            user.Created   = DateTime.Now;
            user.CreatedBy = _authenticatedService.GetUserName();

            _validationService.Validate(_userValidator.Validate(user), new List <(bool, string, object, string)>
            {
                (await _userRepository.ExistsByEmailAsync(user.Email), "Email", user.Email, $"Email {user.Email} already in use")
            });
        public async Task <int> InsertAsync(User user)
        {
            _logger.LogDebug($"User {_authenticatedService.GetUserKey()} is inserting a new User - {user}");

            var parameters = new DynamicParameters();

            parameters.Add("name", user.Name, direction: ParameterDirection.Input);
            parameters.Add("email", user.Email, direction: ParameterDirection.Input);
            parameters.Add("password", user.Password, direction: ParameterDirection.Input);
            parameters.Add("active", user.Active, direction: ParameterDirection.Input);
            parameters.Add("confirmed", user.Confirmed, direction: ParameterDirection.Input);
            parameters.Add("created", user.Created, direction: ParameterDirection.Input);
            parameters.Add("createdby", user.CreatedBy, direction: ParameterDirection.Input);
            parameters.Add("updated", user.Updated, direction: ParameterDirection.Input);
            parameters.Add("updatedby", user.UpdatedBy, direction: ParameterDirection.Input);

            var id = await _sqlService.ExecuteScalarAsync <int>(UserQuery.INSERT, CommandType.Text, parameters);

            _logger.LogDebug($"User {id} inserted");

            return(id);
        }