Electron-rich particle events and the production of gamma-rays by solar flares