code: function(
      query,
      mongooseQuery,
      attributesFilter,
      associations,
      model,
      logger
    ) {
      const Log = logger.bind()
      if (query.$embed) {
        if (!Array.isArray(query.$embed)) {
          query.$embed = query.$embed.split(',')
        }
        query.$embed.forEach(function(embed) {
          let embeds = embed.split('.')
          let populate = {}
  
          populate = nestPopulate(
            query,
            populate,
            0,
            embeds,
            associations,
            model,
            Log
          )
  
          mongooseQuery.populate(populate)
  
          attributesFilter = attributesFilter + ' ' + embeds[0]
        })
        delete query.$embed
        delete query.populateSelect
      }
      return { mongooseQuery: mongooseQuery, attributesFilter: attributesFilter }
    }
docs: Converts the query "$embed" parameter into a mongoose populate object.
  Relies heavily on the recursive "nestPopulate" method.
  @param query: The incoming request query.
  @param mongooseQuery: A mongoose query.
  @param attributesFilter: A filter that lists the fields to be returned.
  Must be updated to include the newly embedded fields.
  @param associations: The current model associations.
  @param model: A mongoose model object
  @param logger: A logging object.
  @returns {{mongooseQuery: *, attributesFilter: *}}: The updated mongooseQuery and attributesFilter.