title: What's the best way to separate concerns for this code?
body: <p>In a <a href="https://stackoverflow.com/questions/1424854/how-do-i-unit-test-a-method-that-is-expecting-an-object-to-be-updated-via-a-refer/1424879#1424879">previous question</a> one of the comments from <a href="https://stackoverflow.com/users/36886/dr-herbie">Dr. Herbie</a> on the accepted answer was that my method was performing two responsibilities..that of changing data and saving data.</p>
  
  <p>What I'm trying to figure out is the best way to separate these concerns in my situation.</p>
  
  <p>Carrying on with my example of having a Policy object which is retrieved via NHibernate....</p>
  
  <p>The way I'm currently setting the policy to inactive is as follows:</p>
  
  <pre><code>Policy policy = new Policy();
  policy.Status = Active;
  
  policyManager.Inactivate(policy);
  
  //method in PolicyManager which has data access and update responsibility
  public void Inactivate(Policy policy)
  {
      policy.Status = Inactive;
      Update(policy);
  }
  </code></pre>
  
  <p>If I were to separate the responsibility of data access and data update what would be the best way to go about it?</p>
  
  <p>Is it better to have the PolicyManager (which acts as the gateway to the dao) manage the state of the Policy object:</p>
  
  <pre><code>Policy policy = new Policy();
  policy.Status = Active;
  
  policyManager.Inactivate(policy);
  policyManager.Update(policy);
  
  //method in PolicyManager
  public void Inactivate(Policy policy)
  {
      policy.Status = Inactive;
  }
  </code></pre>
  
  <p>Or to have the Policy object maintain it's own state and then use the manager class to save the information to the database:</p>
  
  <pre><code>Policy policy = new Policy();
  policy.Status = Active;
  
  policy.Inactivate();
  
  policyManager.Update(policy);
  
  //method in Policy
  public void Inactivate()
  {
      this.Status = Inactive;
  }
  </code></pre>