Particle Acceleration and Trapping in Solar Flares