     tab_apps = _filter_and_fetch_tabs(tab_objects)
 
     return native_apps.concat(tab_apps)
+
+  to_firebase_dict: (apps) ->
+    dict = {}
+    for app in apps
+      dict[app.get_firebase_key()] = app.get_firebase_value()
+    return dict

  constructor: (@window_index, @tab_index, @name) ->
    super(@name)

  activate: () ->
    console.log(@name)

class NativeRunningApp extends RunningApp
  constructor: (@name) ->
    super(@name)

  activate: () ->
    console.log(@name)

# The AppState only considers a list of names, e.g. ['Youtube', 'Spotify', 'Reddit']
# When we scan the list of currently running apps, filter them to get the names and
# then pass the list of currently running app names to the app state's update_app_state
# method. It will make db inserts that will cause the mobile app to update.
class AppState
  update_app_state: (current_apps) ->

  _on_app_inserted: (app) ->

  _on_app_removed: (app) ->


module.exports =

class RunningApp
  constructor: (@name) ->

  get_firebase_key: () ->
    return @name

  get_firebase_value: () ->
    throw new Error('Not implemented')

  equals: (o) -> o? and @name == o.name
