User.Identity.Name An object reference is required for the non-static field
<p>Inside my controller class I have private method which returns logged user which is fetched  using User.Identity.Name as paramater which is all fine.</p>

<pre><code>private static Account GetLoggedUser()
{ 
   AccountService accService = new AccountService();
   Account userAccount = accService.GetAccountByUsername(User.Identity.Name);
   return userAccount;
}

public ActionResult Edit()
{
   var userAccount = GetLoggedUser();
...
}
</code></pre>

<p>Problem is that I'm getting this error on line <code>User.Identity.Name</code></p>

<blockquote>
  <p>An object reference is required for the non-static field,
  method, or property 'System.Web.Mvc.Controller.User.get'</p>
</blockquote>

<p><strong>Error is shown at the compiling time.</strong></p>
