public virtual ActionResult CheckBoxList(string propertyName, object id) { id = CorrectIdType(id); var propertyNameWithoutPrefix = RemovePrefix(propertyName); var propertyMetaData = MetaData.GetProperties() .First(p => p.Name == propertyNameWithoutPrefix); var model = new ComboBoxVM(); model.PropertyName = propertyName; var entity = Repository.GetByPK(id); var m2MEntities = entity.GetValue(propertyNameWithoutPrefix) as IEnumerable; var values = new List <object>(); var otherM2MType = LinqToSqlUtils.GetOtherM2MEntityType(propertyMetaData.Info); var otherM2MPropertyInfo = LinqToSqlUtils.GetOtherM2MPropertyInfo( propertyMetaData.Info); foreach (var m2MEntity in m2MEntities) { values.Add(otherM2MPropertyInfo.GetValue(m2MEntity)); } var source = ComboBoxSourceCreator.GetSource(otherM2MType); model.Source = SelectListUtil.GetSelectedListItems(propertyMetaData, source, values); return(PartialView(Const.Common.FolderControls + Controls.CheckBoxList, model)); }