private async Task AddTeamLead(Employee emp) { //mapping data and creating notification for newly become team leader //notification goes to hr department aswell var teamLead = _dbTeamLeads.MapData(emp); var notify = _dbNotify.MapData($"You({emp.FirstName} {emp.LastName}) have became a team leader.", emp.EmployeeID); var user = await _dbUser.GetUserByEmployeeID(emp.EmployeeID); if (user.CountNotifications == null) { user.CountNotifications = 0; } user.CountNotifications = user.CountNotifications + 1; user.ReadNotifications = false; db.Notifications.Add(notify); _dbUser.Update(user); await _dbUser.UpdateAllWithIncrementedNotification(WorkPosition.HR, 1); db.TeamLeads.Add(teamLead); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }