protected function applyForeignKeys($query, $foreignKeys, $filters = array())
    {
        foreach( $foreignKeys as $key ) {
            if( !$this->hasKey( $filters, $key ) ) {
                continue;
            }

            $query = $query->where($key, '=', $filters[ $key ]);
        }

        return $query;
    }