public ActionResult CreateVoting(int id, CreateVotingModel createVotingModel)
        {
            if (!User.IsInRole("representative")) { return new HttpUnauthorizedResult(); }

            var building = buildingsRepository.GetById(id);

            if(building == null) {
                return HttpNotFound();
            }

            if (ModelState.IsValid) {
                var voting = createVotingModel.Voting;
                try {
                    var administrationJobsType = (AdministrationJobsType) voting.AdministrationJobsType;
                    AdministrationJobsVoting administrationJobsVoting = new AdministrationJobsVoting(administrationJobsType,
                        building, voting.Subject, voting.Description,
                        voting.EndDateTime);

                    adminJobsVotingsRepository.SaveOrUpdate(administrationJobsVoting);
                    var url = Url.Action("voting", "buildingmanagement", new {Id = administrationJobsVoting.Id}, "http");
                    emailNotifier.NotifyOfAdminJobsVotingCreation(administrationJobsVoting, url);
                    return RedirectToAction("building", new { building.Id });

                } catch (BusinessRulesException ex) {
                    ex.CopyTo(ModelState);
                }

            }

            createVotingModel.Roles = Roles.GetRolesForUser();
            createVotingModel.CurrentRole = "representative";
            createVotingModel.Links = new LinksModel() {Id = id, Links = NavLinksGenerator.GetRepresentativeLinks(building, "Rad Uprave")};

            return View(createVotingModel);
        }
        public ActionResult CreateVoting(int id)
        {
            if (!User.IsInRole("representative")) { return new HttpUnauthorizedResult(); }

            var building = buildingsRepository.GetById(id);
            if(building == null) {
                return HttpNotFound();
            }

            var votingCreateModel = new VotingCreateModel() {
                EndDateTime = DateTime.Now.AddDays(1)
            };

            var model = new CreateVotingModel() {
                Voting = votingCreateModel,
                Roles = Roles.GetRolesForUser(),
                CurrentRole = "representative",
                Links = new LinksModel() {Id = building.Id, Links = NavLinksGenerator.GetRepresentativeLinks(building, "Rad uprave")}
            };

            return View(model);
        }