title: What would be the best practice of Scala to have a method accept two different models
body: <p>Currently I have a method that accept <code>ModelA</code> and know to perform actions on it.</p>
  
  <p>so in my controller I accept request of <code>ModelA</code> and call this method with it.</p>
  
  <p>And now, I want to be able to accept request of <code>ModelB</code>, map the request to be of <code>ModelA</code> (cause it has the same data just not all of it and in different names), and call this method with it.</p>
  
  <p>lets say the method would look like:</p>
  
  <pre><code>def myMethod(data: ModelA): ResModel = {
      // do something with data
  }
  </code></pre>
  
  <p>my controller currrently would be:</p>
  
  <pre><code>def doActions(): Action[JValue] = { request =&gt; 
      val dataExctracted = request.body.extract[ModelA]
      myMethod(dataExctracted)
      ...
  }
  </code></pre>
  
  <p>and both of my models are just case classes in seperate files:</p>
  
  <pre><code>case class ModelA(a: String, b: String, c: String)
  
  case class ModelB(aAsDifferentName: String, bAsDifferntName: String)
  </code></pre>
  
  <p>What would be the best practice of Scala to have the myMethod accept both Models (without <code>Either</code>) ? and how the controller should look like in reaction to that?</p>
  
  <p>is there also a classic way to return different models without having to accept the calls in different controller methods?</p>
  
  <p>Thanks!</p>