public async Task ReceiveAsync(IContext context)
        {
            var msg = context.Message;

            switch (msg)
            {
            case Started message:
                _logger.Information($"{nameof(DepartmentManagerActor)} started");
                break;

            case GetDepartmentsRequest request:
                var response = new GetDepartmentsResponse();
                var infos    = _departments.Values.Select(async x => await x.RequestAsync <DepartmentInfo>(request));
                response.DepartmentInfos = await Task.WhenAll(infos);

                context.Respond(response);
                break;

            case CreateDepartmentMessage message:
                var department = GetDepartmentActor(message);
                department.Tell(message);
                break;

            case string message:
                _logger.Information("Message @{message}", new { Message = message, Time = DateTime.Now });
                break;
            }
        }
        public async Task <ActionResult <GetDepartmentsResponse> > GetDepartments()
        {
            var result = new GetDepartmentsResponse
            {
                Departments = await _listOfValuesService.GetAllDepartmentsAsync()
            };

            _logger.LogInformation("Departments found: {0}", result.Departments.Count);
            return(Ok(result));
        }
        public DepartmentInfo[] GetChildDepartments(Identifier orgUnitId)
        {
            GetChildDepartmentsRequest request = new GetChildDepartmentsRequest()
            {
                OrgUnitId = orgUnitId
            };
            GetDepartmentsResponse response = CallWebService <
                IOrgUnitManagementServicev1_0, GetChildDepartmentsRequest, GetDepartmentsResponse>(
                m_service1_0, request, (s, q) => s.GetChildDepartments(q));

            return(response.ChildOrgUnits);
        }