public JsonResult Add()
        {
            AddOrganisationViewModel model = new AddOrganisationViewModel();

            return Json(new
            {
                Html = this.RenderPartialView("_Add", model)
            }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult Add(AddOrganisationViewModel model)
        {
            string message = string.Empty;
            OrganisationsViewModel orgModel = new OrganisationsViewModel();
            try
            {
                var organisation = PopulateOrganisationFromViewModel(model);
                organisationService.AddOrganisation(organisation);

                orgModel.Organisations = organisationService.GetOrganisationsByCompanyId(SocialPipelineUser.CompanyId);
            }
            catch (UnableToAddOrganisationException exception)
            {
                message = "There was an issue registering this new organisation";
            }

            return Json(new
            {
                Html = this.RenderPartialView("_Organisations", orgModel),
                Message = message
            }, JsonRequestBehavior.AllowGet);
        }
 private Organisation PopulateOrganisationFromViewModel(AddOrganisationViewModel model)
 {
     return new Organisation()
                {
                    Active = true,
                    Name = model.Name,
                    CreatedBy = SocialPipelineUser
                };
 }