public IHttpActionResult PostAccount(AccountDTO account) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { bizAccount.createAccount(account); } catch (DbUpdateException) { if (AccountExists(account.username)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = account.username }, account)); }