title: Insert or get in Slick 3
body: <p>I was trying to insert if not exists, and get the row if it does.
  I come up with this:</p>
  
  <pre><code>def saveOrGet(u: User) = (for {
    userGet &lt;- get(u.name).map(r =&gt; (r.id, r.active)).result.headOption
    id &lt;- save(u) if userGet.isEmpty
  } yield {
    userGet match {
      case Some((id, active)) =&gt; (User(Some(id), u.name, active), false)
      case None               =&gt; (User(Some(id), u.name, u.active), true)
    }
  }).transactionally
  
  private def get(name: String) = users.filter(_.name === name).take(1)
  
  private def save(u: User) = users returning users.map(_.id) += u
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>After making some modifications, now I get:</p>
  
  <pre><code>java.util.NoSuchElementException: Action.withFilter failed
  </code></pre>
  
  <p>Regards</p>