static uint8_t server_authorize(struct bt_att *att, uint8_t opcode,
					uint16_t handle, void *user_data)
{
	struct btd_gatt_database *database = user_data;
	struct device_state *state;
	bdaddr_t bdaddr;
	uint8_t bdaddr_type;

	if (!get_dst_info(att, &bdaddr, &bdaddr_type))
		return 0;

	/* Skip if there is no device state */
	state = find_device_state(database, &bdaddr, bdaddr_type);
	if (!state)
		return 0;

	/* Skip if client doesn't support Robust Caching */
	if (!(state->cli_feat[0] & BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING))
		return 0;

	if (state->change_aware)
		return 0;

	if (state->out_of_sync) {
		state->out_of_sync = false;
		state->change_aware = true;
		return 0;
	}

	state->out_of_sync = true;

	return BT_ATT_ERROR_DB_OUT_OF_SYNC;
}
static uint8_t server_authorize(struct bt_att *att, uint8_t opcode,
					uint16_t handle, void *user_data)
{
	struct btd_gatt_database *database = user_data;
	struct device_state *state;
	bdaddr_t bdaddr;
	uint8_t bdaddr_type;

	if (!get_dst_info(att, &bdaddr, &bdaddr_type))
		return 0;

	 
	state = find_device_state(database, &bdaddr, bdaddr_type);
	if (!state)
		return 0;

	 
	if (!(state->cli_feat[0] & BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING))
		return 0;

	if (state->change_aware)
		return 0;

	if (state->out_of_sync) {
		state->out_of_sync = false;
		state->change_aware = true;
		return 0;
	}

	state->out_of_sync = true;

	return BT_ATT_ERROR_DB_OUT_OF_SYNC;
}