public IActionResult Edit(EditOfficeInputViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }

            Office  office  = this.officesService.GetOfficeById(model.Id);
            Company company = this.companiesService.GetCompanyById(office.Company.Id);

            office.Country      = model.Country;
            office.City         = model.City;
            office.Street       = model.Street;
            office.StreetNumber = model.StreetNumber;
            office.Headquarter  = model.Headquarter;

            if (model.Headquarter == true)
            {
                foreach (var currentOffice in company.Offices)
                {
                    if (currentOffice.Headquarter == true && currentOffice.Id != office.Id)
                    {
                        currentOffice.Headquarter = false;

                        this.officesService.UpdateOffice(currentOffice);
                    }
                }
                office.Company.Headquarter = office.City;
            }

            this.officesService.UpdateOffice(office);

            return(this.RedirectToAction("Details", new { @id = office.Id }));
        }
        public IActionResult Edit(string id)
        {
            Office office = this.officesService.GetOfficeById(id);

            if (office == null)
            {
                return(this.View("NotFound"));
            }

            EditOfficeInputViewModel model = new EditOfficeInputViewModel
            {
                Id           = office.Id,
                Country      = office.Country,
                City         = office.City,
                Street       = office.Street,
                StreetNumber = office.StreetNumber,
                Headquarter  = office.Headquarter
            };

            return(this.View(model));
        }