Relate three tables (many-to-many)


What is the best pattern to relate three tables (many-to-many relation) within Diesel?

For example let’s consider the following relation:
users <—>>users_organizations<<—>oranizations

Let’s say I want to create an organization. To support such relation I have to manually add ids of user and organization to users_organizations table. Is there any better approach to implement such relation?
let organization = insert_into(organizations::table)
.map_err(|_| error::ErrorInternalServerError(“Error creating organization”))?;

        let new_user_org = NewUserOrganizationIDs {
            user_id: msg.user_id,

            .map_err(|_| error::ErrorInternalServerError("Error creating user-organization data"))

In case of selecting all organizations that relate to user (and vice verse) I came up with the following code:

let user = users::table.filter(users::id.eq(&msg.user_id))
            .map_err(|_| error::ErrorNotFound("User doesn't exist"))?;
        let user_organizations = UserOrganization::belonging_to(&user)
            .map_err(|_| error::ErrorNotFound("User doesn't have any organization"))?;

        let mut organization_ids = vec![];
        for user_org in &user_organizations {

            .map_err(|_| error::ErrorNotFound("Organizations don't exist"))