private static IList<UserDb> MapUsersFromDb(SqlDataReader sqlDataReader)
        {
            IList<UserDb> result = new List<UserDb>();

            while (sqlDataReader.Read())
            {
                int userId = (int)sqlDataReader["Id"];
                Guid? verifyEmailCode = sqlDataReader.GetValueOrNull<Guid>("VerifyEmailCode");

                var user = new UserDb()
                {
                    Id = userId,
                    Email = (string)sqlDataReader["Email"],
                    Password = sqlDataReader.GetObjectOrNull<string>("Password"),
                    FullName = sqlDataReader.GetObjectOrNull<string>("FullName"),
                    CreatedDate = (DateTime)sqlDataReader["CreatedDate"],
                    TimeStamp = (DateTime)sqlDataReader["UpdatedDate"],
                    VerifyEmailCode = verifyEmailCode,
                    IsVerified = !verifyEmailCode.HasValue
                };

                result.Add(user);
            }

            return result;
        }
        public UserDb UpdateUser(SqlTransaction transaction, UserDb user)
        {
            using (var cmd = new SqlCommand("[dbo].[spUpdateUser]", transaction.Connection, transaction))
            {
                var updatedDate = DateTime.Now;

                cmd.Parameters.AddWithValue("userId", user.Id);
                cmd.Parameters.AddWithValue("password", Helper.ToSqlNullable(user.Password));
                cmd.Parameters.AddWithValue("fullName", Helper.ToSqlNullable(user.FullName));
                cmd.Parameters.AddWithValue("updatedDate", updatedDate);
                cmd.Parameters.AddWithValue("verifyEmailCode", Helper.ToSqlNullable(user.VerifyEmailCode));
                cmd.CommandType = CommandType.StoredProcedure;

                return GetSingleUser(cmd);
            }
        }