public static NewCommunityVm GetNewCommunityVm()
        {
            NewCommunityVm newCommunityVm = new NewCommunityVm()
            {
                Books        = AccountBc.Instance.GetBooks().ToSelectListItemList(),
                ListingTypes = ConverterHelpers.EnumToCheckBoxList <ListingType>(),
                SeniorHousingAndCareCategories = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetSHCCategoriesForCommunity()),
                AgeRestrictions = ConverterHelpers.EnumToCheckBoxList <AgeRestriction>(),
                Address         = AdminViewModelsProvider.GetAddressVm(),
                PhoneList       = AdminViewModelsProvider.GetPhoneList(CommunityType.Community)
            };

            newCommunityVm.PhoneList.AdditionalPhones.ForEach((PhoneVm ph) => ph.PhoneTypes.RemoveAll((SelectListItem pt) => pt.get_Text().Contains("Provision")));
            newCommunityVm.EmailList = AdminViewModelsProvider.GetEmailListVm(CommunityType.Community);
            newCommunityVm.Contacts  = new List <ContactVm>()
            {
                AdminViewModelsProvider.GetContactVm(CommunityType.Community)
            };
            newCommunityVm.OfficeHours = new List <OfficeHoursVm>()
            {
                AdminViewModelsProvider.GetOfficeHoursVm()
            };
            newCommunityVm.CommunityDetails = AdminViewModelsProvider.GetCommunityDetailsVm();
            newCommunityVm.ListingDetails   = AdminViewModelsProvider.GetListingDetailsVm();
            return(newCommunityVm);
        }
        public static EditCommunityVm GetEditCommunityVm(long id)
        {
            if (!CommunityBc.Instance.IsUsersCommunity(id))
            {
                return(null);
            }
            Community       community       = CommunityBc.Instance.GetById(id);
            EditCommunityVm editCommunityVm = new EditCommunityVm();

            editCommunityVm.Id = community.Id;
            editCommunityVm.MarchexAccountId = community.MarchexAccountId;
            editCommunityVm.BookId           = community.Book.Id;
            editCommunityVm.Books            = AccountBc.Instance.GetBooks().ToSelectListItemList();
            editCommunityVm.Package          = community.Package;
            editCommunityVm.ListingTypes     = ConverterHelpers.EnumToCheckBoxList(community.ListingTypes);
            editCommunityVm.SeniorHousingAndCareCategories = ConverterHelpers.DictionaryToCheckBoxList(MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetSHCCategoriesForCommunity(), community.SeniorHousingAndCareCategoryIds);
            editCommunityVm.AgeRestrictions     = ConverterHelpers.EnumToCheckBoxList(community.AgeRestrictions);
            editCommunityVm.Name                = community.Name;
            editCommunityVm.Address             = community.Address.MapToAddressVm();
            editCommunityVm.DoNotDisplayAddress = !community.DisplayAddress;
            editCommunityVm.PhoneList           = community.Phones.MapToPhoneListVm(CommunityType.Community);
            editCommunityVm.PhoneList.AdditionalPhones.ForEach(delegate(PhoneVm ph)
            {
                ph.PhoneTypes.RemoveAll((SelectListItem pt) => pt.Text.Contains("Provision"));
            });
            editCommunityVm.EmailList = community.Emails.MapToEmailListVm(CommunityType.Community);
            List <KeyValuePair <int, string> > contactTypes = MSLivingChoices.Bcs.Admin.Components.ItemTypeBc.Instance.GetContactTypes(CommunityType.Community);

            editCommunityVm.Contacts = ((community.Contacts != null && community.Contacts.Any()) ? community.Contacts.ConvertAll((Contact m) => GetContactVm(m, contactTypes)) : new List <ContactVm>
            {
                GetContactVm(CommunityType.Community)
            });
            editCommunityVm.OfficeHours = ((community.OfficeHours != null && community.OfficeHours.Any()) ? community.OfficeHours.ConvertAll((OfficeHours m) => new OfficeHoursVm(m)) : new List <OfficeHoursVm>
            {
                GetOfficeHoursVm()
            });
            editCommunityVm.Description       = community.Description;
            editCommunityVm.WebsiteUrl        = community.WebsiteUrl;
            editCommunityVm.DisplayWebsiteUrl = community.DisplayWebsiteUrl;
            editCommunityVm.ListingDetails    = community.MapToListingDetailsVm();
            editCommunityVm.CommunityDetails  = community.MapToCommunityDetailsVm();
            editCommunityVm.PublishStart      = community.Publishing.StartDate;
            editCommunityVm.PublishEnd        = community.Publishing.EndDate;
            editCommunityVm.ShowcaseStart     = community.Showcase.StartDate;
            editCommunityVm.ShowcaseEnd       = community.Showcase.EndDate;
            return(editCommunityVm);
        }