public static function startSession($json) { $host = new Host(); $host->name = $json['host']; $host->findOrSave(); $suite = new Suite(); $suite->name = $json['suite']; $suite->findOrSave(); $session = new Session(); $session->hostId = $host->id; $session->suiteId = $suite->id; $session->timestamp = time(); if (isset($json['meta'])) { $session->meta = $json['meta']; } $session->save(); return $session->id; }