//database checked
func generateRemoveModuleTree(id, userId string, officers, assistants map[string]bool, op *jsonpatch.Operation, params map[string]string) (*jsonpatch.CommandContainer, error) {
	if err := checkAuthorityAndValidatePatch(jsonpatch.REMOVE, op.Type, userId, officers); err != nil {
		return nil, err
	}
	command := new(jsonpatch.CommandContainer)
	command.MainCallback = func(transaction, prev interface{}) (interface{}, error) {
		row := transaction.(*sql.Tx).QueryRow("SELECT string_agg(id,'&oid=') from remove_module_tree($1,$2) group by id", id, params["moduleId"])
		var val string
		err := row.Scan(&val)
		if err != nil {
			return nil, err
		}
		return val, nil
	}
	command.AfterCallback = func(transaction, prev interface{}) (interface{}, error) {
		client := serviceclient.New("acl-service")
		return nil, checkStatus(client.Delete(fmt.Sprintf("/objects?oid=%s", prev.(string))))
	}
	return command, nil
}
func buildDefaultCommand(stmt string, params ...interface{}) *jsonpatch.CommandContainer {
	command := new(jsonpatch.CommandContainer)
	command.MainCallback = buildDefaultMainCallback(stmt, params...)
	return command
}