Add groups functionality to client and API