public void RegenerateCallNumbers(int departmentId) { var calls = _callsRepository.GetAll().Where(x => x.DepartmentId == departmentId).OrderBy(x => x.LoggedOn); int year = DateTime.UtcNow.Year; int count = 1; foreach (var call in calls) { call.Number = string.Format("{0}-{1}", year % 100, count); } _callsRepository.SaveOrUpdateAll(calls); }