def METHOD_NAME(client_id):
    form = OAuthSettingForm()
    client = Client.get(client_id)
    if not client:
        flash("no such app", "warning")
        return redirect(url_for("developer.index"))
    if client.user_id != current_user.id:
        flash("you cannot see this app", "warning")
        return redirect(url_for("developer.index"))
    if form.validate_on_submit():
        uris = request.form.getlist("uri")
        # replace all uris. TODO: optimize this?
        for redirect_uri in client.redirect_uris:
            RedirectUri.delete(redirect_uri.id)
        for uri in uris:
            RedirectUri.create(client_id=client_id, uri=uri)
        Session.commit()
        flash(f"{client.name} has been updated", "success")
        return redirect(
            url_for("developer.client_detail_oauth_setting", client_id=client.id)
        )
    return render_template(
        "developer/client_details/oauth_setting.html", form=form, client=client
    )