public ActionResult Create(int buildingId, CreateModel createModel)
        {
            if (!User.IsInRole("buildingmanager")) { return new HttpUnauthorizedResult(); }

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

            if (ModelState.IsValid) {
                // provjeri da li vec postoji katastarska cestica pod tim brojem
                var landRegistryModel = createModel.LandRegistry;

                LandRegistry landRegistry =
                    landRegistriesRepository.GetByNumberOfCadastralParticle(landRegistryModel.NumberOfCadastralParticle);

                if (landRegistry == null) {
                    try {
                        Cadastre cadastre = cadastresRepository.GetById(landRegistryModel.Cadastre);
                        CadastralParticle cadastralParticle = new CadastralParticle(cadastre, landRegistryModel.NumberOfCadastralParticle,
                            landRegistryModel.SurfaceArea, landRegistryModel.Description);

                        landRegistry = new LandRegistry(cadastralParticle);
                        landRegistriesRepository.SaveOrUpdate(landRegistry);

                        building.LandRegistry = landRegistry;

                        return RedirectToAction("landregistry", new { Id = landRegistry.Id });

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

                } else {
                    ModelState.AddModelError("NumberOfCadastralParticle", "Zemljisna knjiga sa takvim brojem katastarske cestice već postoji.");
                }
            }

            createModel.LandRegistry.Cities = new SelectList(citiesRepository.GetCitiesWithCadastres(), "Id", "Name",
                                                      createModel.LandRegistry.City);
            createModel.Roles = Roles.GetRolesForUser();
            createModel.CurrentRole = "buildingmanager";
            createModel.Links = new LinksModel {Id = buildingId, Links = NavLinksGenerator.GetManagerLinks(building)};

            return View(createModel);
        }
        public ActionResult Create(int buildingId)
        {
            if (!User.IsInRole("buildingmanager")) { return new HttpUnauthorizedResult(); }

            var building = buildingsRepository.GetById(buildingId);
            if (building != null) {
                var createLandRegistryModel = new CreateLandRegistryModel() {
                    Cities = new SelectList(citiesRepository.GetCitiesWithCadastres(), "Id", "Name")
                };

                var createModel = new CreateModel() {
                    LandRegistry = createLandRegistryModel,
                    Roles = Roles.GetRolesForUser(),
                    CurrentRole = "buildingmanager",
                    Links = new LinksModel { Id = buildingId, Links = NavLinksGenerator.GetManagerLinks(building)}
                };

                return View(createModel);
            } else {
                return HttpNotFound();
            }
        }