public function save($data, $userId) { if (isset($data['id'])) { return $this->modifyCollection($data, $this->getUser($userId)); } else { return $this->createCollection($data, $this->getUser($userId)); } }