def update( self, trans, id, group_id, **kwd ):
        """
        PUT /api/groups/{encoded_group_id}/roles/{encoded_role_id}
        Adds a role to a group
        """
        role_id = id
        decoded_group_id = trans.security.decode_id( group_id )
        decoded_role_id =  trans.security.decode_id( role_id )
        item = None
        try:
            group = trans.sa_session.query( trans.app.model.Group ).get( decoded_group_id )
            role = trans.sa_session.query( trans.app.model.Role ).get( decoded_role_id )
            for gra in group.roles:
                if gra.role == role:
                    item = dict( id = role_id,
                                   name = role.name,
                                   url = url_for( 'group_role', group_id=group_id, id=role_id) )
            if not item:
                gra = trans.app.model.GroupRoleAssociation( group, role )
                # Add GroupRoleAssociation
                trans.sa_session.add( gra )
                trans.sa_session.flush()
                item = dict( id = role_id,
                             name = role.name,
                             url = url_for( 'group_role', group_id=group_id, id=role_id) )
        except Exception, e:
            item = "Error in group_role API Adding role %s to group %s" % (role.name,group.name)
            log.error(item + ": %s" % str(e))
        return item