How to sort a GPU StructArray vector by a subfield and update location of other elements in place?

Hi! I have the following code:

using Random
using StaticArrays
using StructArrays
using CUDA

# Function to generate a simplified SimParticles with random values
function generate_simplified_particles(num_particles::Int)
    positions = [SVector{3, Float64}(randn(3)) for _ in 1:num_particles]
    densities = [rand() for _ in 1:num_particles]
    types = [1, 2, 3][rand(1:3, num_particles)] # Randomly assign one of these three types
    # Create a StructArray from the generated fields
    particles = StructArray((Position = positions, Density = densities,  Type = types))
    return particles

# Generate 10 random particles
simplified_particles = generate_simplified_particles(10)

# Display the generated particles
for p in simplified_particles
    println("Position: $(p.Position), Density: $(p.Density), Type: $(p.Type)")

sort!(simplified_particles, by = p -> p.Type)

    simplified_particles_GPU = replace_storage(CuVector, simplified_particles)

# How do I properly sort the GPU struct array, similar to what I did for the CPU version?

I want to sort the GPU StructArray in-place similar to what I do for the CPU structarray. Is there a way to do what I wish?

Kind regards