public async Task <ResponseDto <int> > ChangeName(int id, string name) { var departmentFromDb = await _departmentsRepository.GetDepartmentById(id); var departmentWithName = await _departmentsRepository.GetDepartmentByName(name); ResponseDto <int> response = DepartmentsValidator.ValidateChangeName(departmentFromDb, departmentWithName, name); if (response.HasErrors) { return(response); } response.Value = await _departmentsRepository.ChangeName(id, name); return(response); }