public User GetByName(string userName) { try { return this.dataBaseContext.Users.ToList().Single(it => it.UserName == userName); } catch (Exception) { return null; } }