public ObjectViewModel Build(Object @object)
        {
            Class @class = this.handler.Storage.GetRepository<IClassRepository>().WithKey(@object.ClassId);
              IDictionary<string, DataSourceViewModel> dataSourceInstances = new Dictionary<string, DataSourceViewModel>();

              foreach (DataSource dataSource in this.handler.Storage.GetRepository<IDataSourceRepository>().FilteredByClassId(@class.Id))
              {
            System.Type type = System.Type.GetType(dataSource.CSharpClassName);
            IDataSource dataSourceInstance = System.Activator.CreateInstance(type) as IDataSource;

            dataSourceInstance.Initialize(this.handler, @object, this.GetParameters(dataSource.Parameters));
            dataSourceInstances.Add(dataSource.Code, new DataSourceViewModelBuilder(this.handler).Build(dataSourceInstance.GetObjects()));
              }

              return new ObjectViewModel()
              {
            Id = @object.Id,
            Class = new ClassViewModelBuilder(this.handler).Build(@class.Id, @class.ViewName),
            Url = @object.Url,
            Properties = this.handler.Storage.GetRepository<IPropertyRepository>().FilteredByObjectId(@object.Id).ToDictionary(
              p => this.handler.Storage.GetRepository<IMemberRepository>().WithKey(p.MemberId).Code,
              p => new PropertyViewModelBuilder(this.handler).Build(p)
            ),
            DataSources = dataSourceInstances
              };
        }
        public ObjectViewModel Build(CachedObject cachedObject)
        {
            IDictionary<string, DataSourceViewModel> dataSourceInstances = new Dictionary<string, DataSourceViewModel>();

              if (!string.IsNullOrEmpty(cachedObject.CachedDataSources))
              {
            foreach (CachedDataSource cachedDataSource in JsonConvert.DeserializeObject<IEnumerable<CachedDataSource>>(cachedObject.CachedDataSources))
            {
              System.Type type = System.Type.GetType(cachedDataSource.CSharpClassName);
              IDataSource dataSourceInstance = System.Activator.CreateInstance(type) as IDataSource;

              dataSourceInstance.Initialize(this.handler, cachedObject, this.GetParameters(cachedDataSource.Parameters));
              dataSourceInstances.Add(cachedDataSource.Code, new DataSourceViewModelBuilder(this.handler).Build(dataSourceInstance.GetCachedObjects()));
            }
              }

              IEnumerable<CachedProperty> cachedProperties = JsonConvert.DeserializeObject<IEnumerable<CachedProperty>>(cachedObject.CachedProperties);

              return new ObjectViewModel()
              {
            Id = cachedObject.ObjectId,
            Class = new ClassViewModelBuilder(this.handler).Build(cachedObject.ClassId, cachedObject.ClassViewName),
            Url = cachedObject.Url,
            Properties = cachedProperties.ToDictionary(
              cp => cp.MemberCode,
              cp => new PropertyViewModelBuilder(this.handler).Build(cp)
            ),
            DataSources = dataSourceInstances
              };
        }
        private IDictionary<TabViewModel, IEnumerable<MemberViewModel>> GetMembersByTabs(Object @object, int? classId = null, int? objectId = null)
        {
            Dictionary<TabViewModel, IEnumerable<MemberViewModel>> membersByTabs = new Dictionary<TabViewModel, IEnumerable<MemberViewModel>>();

              membersByTabs.Add(new TabViewModel() { Name = "General" }, new List<MemberViewModel>());

              foreach (Tab tab in this.handler.Storage.GetRepository<ITabRepository>().FilteredByClassId(@object != null ? @object.ClassId : (int)classId))
            membersByTabs.Add(new TabViewModelBuilder(this.handler).Build(tab), new List<MemberViewModel>());

              foreach (Member member in this.handler.Storage.GetRepository<IMemberRepository>().FilteredByClassId(@object != null ? @object.ClassId : (int)classId))
              {
            TabViewModel tab = null;

            if (member.TabId == null)
              tab = membersByTabs.Keys.FirstOrDefault(t => t.Id == 0);

            else tab = membersByTabs.Keys.FirstOrDefault(t => t.Id == (int)member.TabId);

            (membersByTabs[tab] as List<MemberViewModel>).Add(new MemberViewModelBuilder(this.handler).Build(member, @object, objectId));
              }

              return membersByTabs;
        }