def process(proc_data):
    """
    Final processing to conform to the schema.

    Parameters:

        proc_data:   (Dictionary) raw structured data to process

    Returns:

        Dictionary. Structured data with the following schema:

        {
          "uid": {
            "id":       integer,
            "name":     string
          },
          "gid": {
            "id":       integer,
            "name":     string
          },
          "groups": [
            {
              "id":     integer,
              "name":   string
            },
            {
              "id":     integer,
              "name":   string
            }
          ],
          "context": {
            "user":     string,
            "role":     string,
            "type":     string,
            "level":    string
          }
        }
    """
    if 'uid' in proc_data:
        if 'id' in proc_data['uid']:
            try:
                proc_data['uid']['id'] = int(proc_data['uid']['id'])
            except (ValueError):
                proc_data['uid']['id'] = None

    if 'gid' in proc_data:
        if 'id' in proc_data['gid']:
            try:
                proc_data['gid']['id'] = int(proc_data['gid']['id'])
            except (ValueError):
                proc_data['gid']['id'] = None

    if 'groups' in proc_data:
        for group in proc_data['groups']:
            if 'id' in group:
                try:
                    group['id'] = int(group['id'])
                except (ValueError):
                    group['id'] = None

    return proc_data