private static SubEntity BuildHoursSubEntity(ProviderAdminDetailView parent, ProviderOrgUnitDto providerOrgUnit)
        {
            var subEntity = new SubEntity() { EntityName = _hoursSubEntity, DisplayName = "Hours", CanCreateNew = true, CanDelete = true };

            var scheduleRequest = new ListProviderOrgUnitScheduleRequest()
            {
                ProviderOrgUnitId = providerOrgUnit.Id
            };
            var schedules = parent.ProcessRequest<ListProviderOrgUnitScheduleResponse>(scheduleRequest).ScheduleTimeSpans;

            //Existing Records
            foreach (var schedule in schedules)
            {
                var record = new SubEntityRecord();

                record.Fields.Add(new Field(_id, _id, FieldTypes.Hidden, schedule.Id));
                record.Fields.Add(new Field(_providerOrgUnitId, _providerOrgUnitId, FieldTypes.Hidden, providerOrgUnit.Id));
                record.Fields.Add(new Field("Description", schedule.Day, FieldTypes.Label, schedule.Open + " - " + schedule.Close));

                subEntity.Records.Add(record);
            }

            //New Record Template
            subEntity.NewRecordTemplate.Fields.Add(new Field(_providerOrgUnitId, _providerOrgUnitId, FieldTypes.Hidden, providerOrgUnit.Id));
            subEntity.NewRecordTemplate.Fields.Add(CommonUtils.CreateDayDropDownField());
            subEntity.NewRecordTemplate.Fields.Add(new Field("OpenTime", "Open Time", FieldTypes.Text, "8:00 AM"));
            subEntity.NewRecordTemplate.Fields.Add(new Field("CloseTime", "Close Time", FieldTypes.Text, "5:00 PM"));

            return subEntity;
        }
        private static SubEntity BuildServicesSubEntity(ProviderAdminDetailView parent, ProviderOrgUnitDto providerOrgUnit)
        {
            var subEntity = new SubEntity() { EntityName = ProviderAdminDetailView._providerOrgUnitServicesSubEntity, DisplayName = "Services", CanAddExisting = true, CanCreateNew = true, CanDelete = true };

            foreach (var service in providerOrgUnit.Service)
            {
                var record = new SubEntityRecord();

                record.Fields.Add(new Field(_serviceId, _serviceId, FieldTypes.Hidden, service.Id));
                record.Fields.Add(new Field("ServiceName", "Service Name", FieldTypes.Label, service.ServiceName));

                subEntity.Records.Add(record);
            }

            subEntity.NewRecordTemplate.Fields.Add(new Field(_providerOrgUnitId, _providerOrgUnitId, FieldTypes.Hidden, providerOrgUnit.Id));
            subEntity.NewRecordTemplate.Fields.Add(new Field("ServiceName", "Service Name", FieldTypes.Text, null, true) { Focus = true });

            return subEntity;
        }
 public bool Equals(ProviderOrgUnitDto other)
 {
     return other.OrgUnitName == OrgUnitName;
 }