public async Task <ApplicationResponseDto> InsertOfficeAsync(Guid user, NewPrivateEntityOfficeRequestDto dto)
        {
            var application = await GetPrivateEntityApplicationAsync(user, dto.ApplicationId);

            application.PrivateEntity.Office         = _mapper.Map <Office>(dto);
            application.PrivateEntity.IndustrySector = dto.IndustrySector;
            return(await ReturnApplicationResponse(application));
        }
        public async Task <ApplicationResponseDto> NewPrivateEntityOfficeAsync(NewPrivateEntityOfficeRequestDto dto)
        {
            var response = await _client.PostAsJsonAsync("entity/office", dto);

            if (response.IsSuccessStatusCode)
            {
                return(await response.Content.ReadAsAsync <ApplicationResponseDto>());
            }
            return(null);
        }
        public async Task <IActionResult> Office([FromBody] NewPrivateEntityOfficeRequestDto dto)
        {
            User user;

            using (var client = new HttpClient())
            {
                var accessToken = await HttpContext.GetTokenAsync("access_token");

                client.SetBearerToken(accessToken);
                var response = await client.GetAsync("https://localhost:5001/connect/userinfo");

                if (response.IsSuccessStatusCode)
                {
                    user = await response.Content.ReadAsAsync <User>();
                }
                else
                {
                    return(Unauthorized());
                }
            }

            return(Ok(await _privateEntityService.InsertOfficeAsync(user.Sub, dto)));
        }