code: function (groupId, operation, req, res) {
          const validateSections = function (group) {
              let valid = true;
              const sections = server.state.get('sections');
              group.forEach(function (e) {
                  if (Utils.isNullOrEmpty(sections[e])) {
                      valid = false;
                  }
              });
              return valid;
          };
          if (!req.body || !req.body.length || !validateSections(req.body)) {
              log.error('Invalid Group', 'request:', JSON.stringify(req.body));
              Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid group' }));
          } else {
              server.state.set('groups[' + groupId + ']', req.body.slice());
              log.info('Successfully ' + operation + 'd group:', groupId);
              Utils.sendMessage(res, HttpStatus.OK, JSON.stringify({ id: parseInt(groupId, 10) }));
          }
      }
docs: Internal utility function to create or update a group