How to return a None if all components are also None, otherwise Some
<p>I have a case class like:</p>

<pre><code>case class Part1(id: Int)
case class Part2(id: Int)
case class Part3(id: Int)
</code></pre>

<p>The above are all included in the below Parts class:</p>

<pre><code>case class Parts(part1: Option[Part1], part2: Option[Part2], part3: Option[Part3])
</code></pre>

<p>Now currently in my code I have:</p>

<pre><code>case (maybePart1, maybePart2, maybePart3) =&gt; 
  Parts(maybePart1, maybePart2, maybePart3)
</code></pre>

<p>But what I really want to do is return None if all of them are None, otherwise return what I am doing above.</p>

<p>How can I do this?</p>