public ActionResult AddContractors()
        {
            if (!User.IsInRole("buildingmanager")) { return new HttpUnauthorizedResult(); }

            LegalPerson legalPerson = personsRepository.GetLegalPersonByUsername(User.Identity.Name);
            var buildingManager = buildingManagersRepository.GetByLegalPerson(legalPerson);
            var constractors = contractorsRepository.GetNonBuildingMgmtContractors(buildingManager.Id);
            var model = new AddContractorsModel() {
                Contractors = Mapper.Map<ICollection<Contractor>, ICollection<ContractorModel>>(constractors),
                Roles = Roles.GetRolesForUser()
            };

            return View(model);
        }
        public ActionResult AddContractors(AddContractorsModel addContractorsModel)
        {
            if (!User.IsInRole("buildingmanager")) { return new HttpUnauthorizedResult(); }

            LegalPerson legalPerson = personsRepository.GetLegalPersonByUsername(User.Identity.Name);
            var buildingManager = buildingManagersRepository.GetByLegalPerson(legalPerson);
            if(ModelState.IsValid) {
                foreach (var selectedContractorId in addContractorsModel.SelectedContractors) {
                    var contractor = contractorsRepository.GetById(selectedContractorId);
                    buildingManager.AddContractor(contractor);
                }

                return RedirectToAction("contractors");

            }

            addContractorsModel.Roles = Roles.GetRolesForUser();

            var constractors = contractorsRepository.GetNonBuildingMgmtContractors(buildingManager.Id);
            addContractorsModel.Contractors = Mapper.Map<ICollection<Contractor>, ICollection<ContractorModel>>(constractors);

            return View(addContractorsModel);
        }