Beispiel #1
0
 public ApiController()
 {
     recMan = new RecordManager();
     secMan = new SecurityManager();
     entMan = new EntityManager();
     relMan = new EntityRelationManager();
 }
Beispiel #2
0
 public WebHooks()
 {
     recMan = new RecordManager();
     secMan = new SecurityManager();
     entMan = new EntityManager();
     relMan = new EntityRelationManager();
 }
		public ApiController(IErpService service, IStorageService storage) : base(service)
		{
			Storage = storage;
			recMan = new RecordManager(service);
			secMan = new SecurityManager(service);
			entityManager = new EntityManager(storage);
		}
 public ApiDevelopersController(IErpService service) : base(service)
 {
     em = new EntityManager(service.StorageService);
     rm = new EntityRelationManager(service.StorageService);
     recMan = new RecordManager(service);
     fs = service.StorageService.GetFS();
 }
 public ImportExportManager(IWebHookService hooksService)
 {
     recMan = new RecordManager();
     secMan = new SecurityManager();
     entMan = new EntityManager();
     relMan = new EntityRelationManager();
     this.hooksService = hooksService;
 }
 public bool UpdateUserLastLoginTime(Guid userId)
 {
     RecordManager recMan = new RecordManager(service);
     var record = new EntityRecord();
     record["id"] = userId;
     record["last_logged_in"] = DateTime.UtcNow;
     var response = recMan.UpdateRecord("user", record);
     return response.Success;
 }
Beispiel #7
0
        public ErpUser GetUser(string email)
        {
            RecordManager recMan = new RecordManager(true);
            EntityQuery query = new EntityQuery("user", fieldsToQuery, EntityQuery.QueryEQ("email", email), null, null, null);
            var result = recMan.Find(query);
            if (!result.Success)
                throw new Exception(result.Message);

            if (!result.Object.Data.Any())
                return null;

            var record = result.Object.Data.Single();
            return record.DynamicMapTo<ErpUser>();
        }
Beispiel #8
0
        public ErpUser GetUser(string email, string password)
        {
            var query = EntityQuery.QueryAND(EntityQuery.QueryEQ("email", email), EntityQuery.QueryEQ("password", password));
            var result = new RecordManager(true).Find(new EntityQuery("user", fieldsToQuery, query));

            if (!result.Success)
                throw new Exception(result.Message);

            ErpUser user = null;
            if (result.Object.Data != null && result.Object.Data.Any())
                user = result.Object.Data[0].DynamicMapTo<ErpUser>();

            return user;
        }
Beispiel #9
0
        public ErpUser GetUser(string email, string password)
        {
            var query  = EntityQuery.QueryAND(EntityQuery.QueryEQ("email", email), EntityQuery.QueryEQ("password", password));
            var result = new RecordManager(true).Find(new EntityQuery("user", fieldsToQuery, query));

            if (!result.Success)
            {
                throw new Exception(result.Message);
            }

            ErpUser user = null;

            if (result.Object.Data != null && result.Object.Data.Any())
            {
                user = result.Object.Data[0].DynamicMapTo <ErpUser>();
            }

            return(user);
        }
Beispiel #10
0
        public ErpUser GetUser(string email)
        {
            RecordManager recMan = new RecordManager(true);
            EntityQuery   query  = new EntityQuery("user", fieldsToQuery, EntityQuery.QueryEQ("email", email), null, null, null);
            var           result = recMan.Find(query);

            if (!result.Success)
            {
                throw new Exception(result.Message);
            }

            if (!result.Object.Data.Any())
            {
                return(null);
            }

            var record = result.Object.Data.Single();

            return(record.DynamicMapTo <ErpUser>());
        }
Beispiel #11
0
        private static void Patch160430(EntityManager entMan, EntityRelationManager relMan, RecordManager recMan, bool createSampleRecords = false)
        {
            #region << Create CRM admin area >>
            //The areas are the main object for navigation for the user. You can attach entities and URLs later to them
            {
                var area = new EntityRecord();
                area["id"] = CRM_ADMIN_AREA_ID;
                area["name"] = "crm_admin";
                area["label"] = "CRM Admin";
                area["icon_name"] = "users";
                area["color"] = "pink";
                area["folder"] = "Admin";
                area["weight"] = 100;
                var areaRoles = new List<Guid>();
                areaRoles.Add(SystemIds.AdministratorRoleId);
                area["roles"] = JsonConvert.SerializeObject(areaRoles);
                var createAreaResult = recMan.CreateRecord("area", area);
                if (!createAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area create with name : project_admin. Message:" + createAreaResult.Message);
                }
            }
            #endregion

            #region << wv_customer >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = CUSTOMER_ENTITY_ID;
                    entity.Name = CUSTOMER_ENTITY_NAME;
                    entity.Label = "Customer";
                    entity.LabelPlural = "Customers";
                    entity.System = true;
                    entity.IconName = "building-o";
                    entity.Weight = 2;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("e8564a56-9917-4c45-a264-4c080f2d2b31");
                    systemItemIdDictionary["created_on"] = new Guid("1ca9c660-0042-47b3-91c7-e0f2b817633c");
                    systemItemIdDictionary["created_by"] = new Guid("12c29d6a-b5e5-4293-9e8a-91475d10dac9");
                    systemItemIdDictionary["last_modified_on"] = new Guid("b6a172aa-b50a-403f-a178-f923a0d7576f");
                    systemItemIdDictionary["last_modified_by"] = new Guid("6aab2af3-6909-4f8d-8c54-6a2403d6a25a");
                    systemItemIdDictionary["user_wv_customer_created_by"] = new Guid("2d2045f4-0553-4ffd-bd12-cbef17aea14a");
                    systemItemIdDictionary["user_wv_customer_modified_by"] = new Guid("2ba6c8c5-2550-4f26-8611-f397c529a61c");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + CUSTOMER_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << name >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9");
                    textboxField.Name = "name";
                    textboxField.Label = "Name";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(CUSTOMER_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Field: name" + " Message:" + response.Message);
                    }
                }
                #endregion

            }
            #endregion

            #region << View name: admin_details >>
            {
                var createViewEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                var createViewInput = new InputRecordView();
                var viewRegion = new InputRecordViewRegion();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();

                #region << details >>
                createViewInput.Id = new Guid("3a0e1319-5357-49ec-9e85-8d9be2363fcf");
                createViewInput.Type = "hidden";
                createViewInput.Name = "admin_details";
                createViewInput.Label = "Details";
                createViewInput.Title = "";
                createViewInput.Default = false;
                createViewInput.System = true;
                createViewInput.Weight = 15;
                createViewInput.CssClass = null;
                createViewInput.IconName = "building-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                createViewInput.Regions = new List<InputRecordViewRegion>();
                #endregion

                #region << Header Region >>
                viewRegion = new InputRecordViewRegion();
                viewRegion.Name = "header";
                viewRegion.Label = "Header";
                viewRegion.Render = true;
                viewRegion.Weight = 1;
                viewRegion.CssClass = "";
                viewRegion.Sections = new List<InputRecordViewSection>();

                #region << Section >>
                viewSection = new InputRecordViewSection();
                viewSection.Id = new Guid("201882a6-c1f8-4f84-878d-fddfacdcb2d7");
                viewSection.Name = "details";
                viewSection.Label = "Details";
                viewSection.ShowLabel = false;
                viewSection.CssClass = "";
                viewSection.Collapsed = false;
                viewSection.TabOrder = "left-right";
                viewSection.Weight = 1;
                viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row >>
                viewRow = new InputRecordViewRow();
                viewRow.Id = new Guid("ce09fdad-bb23-4f7f-b64b-190fec656711");
                viewRow.Weight = 1;
                viewRow.Columns = new List<InputRecordViewColumn>();

                #region << Column 1 >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 12;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << name >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = CUSTOMER_ENTITY_ID;
                    viewItem.EntityName = CUSTOMER_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItem.FieldName = "name";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                //Save row
                viewSection.Rows.Add(viewRow);
                #endregion

                //Save section
                viewRegion.Sections.Add(viewSection);
                #endregion

                //Save region
                createViewInput.Regions.Add(viewRegion);
                #endregion

                #region << relation options >>
                createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();
                #endregion

                #region << action items >>
                createViewInput.ActionItems = new List<ActionItem>();
                var actionItem = new ActionItem();
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_record_delete";
                    actionItem.Menu = "page-title-dropdown";
                    actionItem.Weight = 1;
                    actionItem.Template = "" +
            @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
                                        ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
                                    <i class=""fa fa-trash go-red""></i> Delete Record
                                </a>";
                    createViewInput.ActionItems.Add(actionItem);
                }
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_back_button";
                    actionItem.Menu = "sidebar-top";
                    actionItem.Weight = 1;
                    actionItem.Template = "" +
            @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                    createViewInput.ActionItems.Add(actionItem);
                }
                #endregion

                {
                    var response = entMan.CreateRecordView(CUSTOMER_ENTITY_ID, createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Updated view: admin_details" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << View name: admin_create >>
            {
                var createViewEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                var createViewInput = new InputRecordView();
                var viewRegion = new InputRecordViewRegion();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();

                #region << details >>
                createViewInput.Id = new Guid("93043954-ae70-41a3-b4b7-665531a23a76");
                createViewInput.Type = "create";
                createViewInput.Name = "admin_create";
                createViewInput.Label = "Create customer";
                createViewInput.Title = "";
                createViewInput.Default = false;
                createViewInput.System = true;
                createViewInput.Weight = 25;
                createViewInput.CssClass = null;
                createViewInput.IconName = "building-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                createViewInput.Regions = new List<InputRecordViewRegion>();
                #endregion

                #region << Header Region >>
                viewRegion = new InputRecordViewRegion();
                viewRegion.Name = "header";
                viewRegion.Label = "Header";
                viewRegion.Render = true;
                viewRegion.Weight = 1;
                viewRegion.CssClass = "";
                viewRegion.Sections = new List<InputRecordViewSection>();

                #region << Section >>
                viewSection = new InputRecordViewSection();
                viewSection.Id = new Guid("8d82e33e-139a-4c80-99ac-3721138bdc65");
                viewSection.Name = "details";
                viewSection.Label = "Details";
                viewSection.ShowLabel = false;
                viewSection.CssClass = "";
                viewSection.Collapsed = false;
                viewSection.TabOrder = "left-right";
                viewSection.Weight = 1;
                viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row >>
                viewRow = new InputRecordViewRow();
                viewRow.Id = new Guid("cdc2da04-f92a-47e1-9259-6526816fe84d");
                viewRow.Weight = 1;
                viewRow.Columns = new List<InputRecordViewColumn>();

                #region << Column 1 >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 12;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << name >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = CUSTOMER_ENTITY_ID;
                    viewItem.EntityName = CUSTOMER_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItem.FieldName = "name";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                //Save row
                viewSection.Rows.Add(viewRow);
                #endregion

                //Save section
                viewRegion.Sections.Add(viewSection);
                #endregion

                //Save region
                createViewInput.Regions.Add(viewRegion);
                #endregion

                #region << relation options >>
                createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();
                #endregion

                #region << action items >>
                createViewInput.ActionItems = new List<ActionItem>();
                var actionItem = new ActionItem();

                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_create_and_list";
                    actionItem.Menu = "create-bottom";
                    actionItem.Weight = 1;
                    actionItem.Template = "" +
            @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""ngCtrl.createViewRegion != null"">Create</a>";
                    createViewInput.ActionItems.Add(actionItem);
                }
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_create_and_details";
                    actionItem.Menu = "create-bottom";
                    actionItem.Weight = 2;
                    actionItem.Template = "" +
            @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""ngCtrl.createViewRegion != null"">Create & Details</a>";
                    createViewInput.ActionItems.Add(actionItem);
                }
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_create_cancel";
                    actionItem.Menu = "create-bottom";
                    actionItem.Weight = 3;
                    actionItem.Template = "" +
            @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                    createViewInput.ActionItems.Add(actionItem);
                }
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_back_button";
                    actionItem.Menu = "sidebar-top";
                    actionItem.Weight = 1;
                    actionItem.Template = "" +
            @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                    createViewInput.ActionItems.Add(actionItem);
                }
                #endregion
                {
                    var response = entMan.CreateRecordView(CUSTOMER_ENTITY_ID, createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Updated view: admin_create" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << List name: admin >>
            {
                var createListEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                var createListInput = new InputRecordList();
                var listItem = new InputRecordListFieldItem();
                var listSort = new InputRecordListSort();
                var listQuery = new InputRecordListQuery();

                #region << details >>
                createListInput.Id = new Guid("ff15f200-8e68-4683-8576-4c8244405ca9");
                createListInput.Type = "hidden";
                createListInput.Name = "admin";
                createListInput.Label = "Customers";
                createListInput.Weight = 11;
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "building-o";
                createListInput.VisibleColumnsCount = 7;
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = 10;
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << action items >>
                createListInput.ActionItems = new List<ActionItem>();
                var actionItem = new ActionItem();
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_record_details";
                    actionItem.Menu = "record-row";
                    actionItem.Weight = 1;
                    actionItem.Template = "" +
            @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                            <i class=""fa fa-fw fa-eye""></i>
                            </a>";
                    createListInput.ActionItems.Add(actionItem);
                }
                {
                    actionItem = new ActionItem();
                    actionItem.Name = "wv_create_record";
                    actionItem.Menu = "page-title";
                    actionItem.Weight = 1;
                    actionItem.Template = "" +
            @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                    createListInput.ActionItems.Add(actionItem);
                }
                #endregion

                #region << Columns >>
                createListInput.Columns = new List<InputRecordListItemBase>();
                #region << name >>
                {
                    var fieldName = "name";
                    listItem = new InputRecordListFieldItem();
                    listItem.EntityId = CUSTOMER_ENTITY_ID;
                    listItem.EntityName = CUSTOMER_ENTITY_NAME;
                    listItem.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                    listItem.FieldName = fieldName;
                    listItem.Type = "field";
                    createListInput.Columns.Add(listItem);
                }
                #endregion

                #endregion

                #region << relation options >>
                createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                #endregion

                #region << query >>
                listQuery = new InputRecordListQuery();
                #endregion

                #region << Sort >>
                listSort = new InputRecordListSort();
                #endregion
                {
                    var response = entMan.CreateRecordList(CUSTOMER_ENTITY_ID, createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + CUSTOMER_ENTITY_NAME + " Updated List: admin" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << area add subscription: CRM Admin -> Customer >>
            {
                var updatedAreaId = CRM_ADMIN_AREA_ID;
                var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, CUSTOMER_ENTITY_NAME, "admin_details", "admin_create", "admin");
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << customer lookup list >>
            {
                var createListEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                var createListInput = new InputRecordList();
                var listItem = new InputRecordListFieldItem();
                var listSort = new InputRecordListSort();
                var listQuery = new InputRecordListQuery();

                //General list details
                createListInput.Id = new Guid("2287d4dc-0e9e-4c00-a1d4-cc2b8bf0f315");
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Type = "lookup";
                createListInput.Default = true;
                createListInput.VisibleColumnsCount = 5;
                createListInput.System = true;
                createListInput.Weight = 10;
                createListInput.CssClass = null;
                createListInput.IconName = "list";
                createListInput.Columns = new List<InputRecordListItemBase>();
                //Fields
                #region << name >>
                listItem = new InputRecordListFieldItem();
                listItem.EntityId = CUSTOMER_ENTITY_ID;
                listItem.EntityName = "customer";
                listItem.FieldId = createListEntity.Fields.Single(x => x.Name == "name").Id;
                listItem.FieldName = "name";
                listItem.Type = "field";
                createListInput.Columns.Add(listItem);
                #endregion

                //Query
                #region << query descr >>
                listQuery = new InputRecordListQuery();
                #endregion

                //Sort
                #region << Sort >>
                createListInput.Sorts = new List<InputRecordListSort>();
                listSort = new InputRecordListSort();
                listSort.FieldName = "name";
                listSort.SortType = "ascending";
                createListInput.Sorts.Add(listSort);
                #endregion

                var newActionItemList = new List<ActionItem>();
                {
                    var actionItem = new ActionItem();
                    actionItem.Name = "wv_create_record";
                    actionItem.Menu = "page-title";
                    actionItem.Template = "<a class=\"btn btn-default btn-outline hidden-xs\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate')\" \n    ng-href=\"{{::ngCtrl.getRecordCreateUrl()}}\">Add New</a>";
                    actionItem.Weight = 1;
                    newActionItemList.Add(actionItem);
                }
                {
                    var actionItem = new ActionItem();
                    actionItem.Name = "wv_record_details";
                    actionItem.Menu = "record-row";
                    actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-href=\"{{::ngCtrl.getRecordDetailsUrl(record)}}\">\n    <i class=\"fa fa-fw fa-eye\"></i>\n</a>";
                    actionItem.Weight = 1;
                    newActionItemList.Add(actionItem);
                }

                createListInput.ActionItems = newActionItemList;

                {
                    var responseObject = entMan.CreateRecordList(CUSTOMER_ENTITY_ID, createListInput);
                    if (!responseObject.Success)
                        throw new Exception("System error 10060. Entity: " + "user" + " Updated List: list_name" + " Message:" + responseObject.Message);
                }
            }
            #endregion

            if (createSampleRecords)
            {
                #region << Create Sample Customer >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("fb06213f-7632-495b-bb8d-ed5ff07dc515");
                    sampleRecord["name"] = "Buckley Miller & Wright";
                    var createSampleRecordResult = recMan.CreateRecord(CUSTOMER_ENTITY_NAME, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample record. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create Sample Customer User >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("307fe376-a1c6-495e-a7c0-2a78797565f2");
                    sampleRecord["first_name"] = "Sample";
                    sampleRecord["last_name"] = "Customer";
                    sampleRecord["username"] = "******";
                    sampleRecord["email"] = "*****@*****.**";
                    sampleRecord["password"] = "******";
                    sampleRecord["enabled"] = true;
                    sampleRecord["verified"] = true;
                    sampleRecord["image"] = "/plugins/webvella-core/assets/avatar-deep-purple.png";
                    var createSampleRecordResult = recMan.CreateRecord(SystemIds.UserEntityId, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample customer record. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create Sample User Role>>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("27745245-09bd-4adb-8831-3870bcae46fe");
                    sampleRecord["name"] = "crm_customer";
                    sampleRecord["description"] = "Sample Customer role for CRM application";
                    var createSampleRecordResult = recMan.CreateRecord(SystemIds.RoleEntityId, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample role record. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create relation between sample customer and role >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("27745245-09bd-4adb-8831-3870bcae46fe"), new Guid("307fe376-a1c6-495e-a7c0-2a78797565f2"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create relation between sample customer and regular role >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("f16ec6db-626d-4c27-8de0-3e7ce542c55f"), new Guid("307fe376-a1c6-495e-a7c0-2a78797565f2"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

            }
        }
Beispiel #12
0
        private List<ResponseTreeNode> GetTreeRecords(List<Entity> entities, List<EntityRelation> relationList, RecordTree tree)
        {
            EntityRelation relation = relationList.FirstOrDefault(r => r.Id == tree.RelationId);

            Guid treeEntityId = relation.OriginEntityId;
            Guid treeRelFieldId = relation.OriginFieldId;

            Entity treeEntity = entities.FirstOrDefault(e => e.Id == treeEntityId);
            Field treeIdField = treeEntity.Fields.FirstOrDefault(f => f.Id == treeRelFieldId);
            Field treeParrentField = treeEntity.Fields.FirstOrDefault(f => f.Id == tree.NodeParentIdFieldId);
            Field nameField = treeEntity.Fields.FirstOrDefault(f => f.Id == tree.NodeNameFieldId);
            Field labelField = treeEntity.Fields.FirstOrDefault(f => f.Id == tree.NodeLabelFieldId);
            Field weightField = treeEntity.Fields.FirstOrDefault(f => f.Id == tree.NodeWeightFieldId);

            var relIdField = treeEntity.Fields.Single(x => x.Name == "id");

            List<Guid> fieldIdsToInclude = new List<Guid>();

            if (!fieldIdsToInclude.Contains(treeIdField.Id))
                fieldIdsToInclude.Add(treeIdField.Id);

            if (!fieldIdsToInclude.Contains(treeParrentField.Id))
                fieldIdsToInclude.Add(treeParrentField.Id);

            if (!fieldIdsToInclude.Contains(tree.NodeNameFieldId))
                fieldIdsToInclude.Add(tree.NodeNameFieldId);

            if (!fieldIdsToInclude.Contains(tree.NodeLabelFieldId))
                fieldIdsToInclude.Add(tree.NodeLabelFieldId);

            var weightFieldNonNullable = Guid.Empty;
            if(tree.NodeWeightFieldId.HasValue) {
                weightFieldNonNullable = tree.NodeWeightFieldId.Value;
            }
            if (weightField != null && !fieldIdsToInclude.Contains(weightFieldNonNullable))
                fieldIdsToInclude.Add(weightFieldNonNullable);

            string queryFields = string.Empty;
            foreach (var fieldId in fieldIdsToInclude)
            {
                var f = treeEntity.Fields.SingleOrDefault(x => x.Id == fieldId);
                if (f != null)
                {
                    if (!queryFields.Contains(f.Name))
                        queryFields += (f.Name + ",");
                }
            }
            queryFields += "id";

            EntityQuery eq = new EntityQuery(treeEntity.Name, queryFields);
            RecordManager recMan = new RecordManager(service);
            var allRecords = recMan.Find(eq).Object.Data;

            List<ResponseTreeNode> rootNodes = new List<ResponseTreeNode>();
            foreach (var rootNode in tree.RootNodes.OrderBy(x=>x.Name))
            {
                List<ResponseTreeNode> children = new List<ResponseTreeNode>();
                int? rootNodeWeight = null;
                if(weightField != null) {
                    rootNodeWeight = rootNode.Weight;
                    children = GetTreeNodeChildren(allRecords, treeIdField.Name,
                                     treeParrentField.Name, nameField.Name, labelField.Name, rootNode.Id, weightField.Name, 1, tree.DepthLimit);
                }
                else {
                    children = GetTreeNodeChildren(allRecords, treeIdField.Name,
                                     treeParrentField.Name, nameField.Name, labelField.Name, rootNode.Id, "no-weight", 1, tree.DepthLimit);
                }
                rootNodes.Add(new ResponseTreeNode
                {
                    RecordId = rootNode.RecordId,
                    Id = rootNode.Id.Value,
                    ParentId = rootNode.ParentId,
                    Name = rootNode.Name,
                    Label = rootNode.Label,
                    Weight = rootNodeWeight,
                    Nodes = children
                });

            }

            return rootNodes;
        }
Beispiel #13
0
        public IActionResult UpdateEntityRelationRecord([FromBody]InputEntityRelationRecordUpdateModel model)
        {
            var recMan = new RecordManager(service);
            var entMan = new EntityManager(service.StorageService);
            BaseResponseModel response = new BaseResponseModel { Timestamp = DateTime.UtcNow, Success = true, Errors = new List<ErrorModel>() };

            if (model == null)
            {
                response.Errors.Add(new ErrorModel { Message = "Invalid model." });
                response.Success = false;
                return DoResponse(response);
            }

            EntityRelation relation = null;
            if (string.IsNullOrWhiteSpace(model.RelationName))
            {
                response.Errors.Add(new ErrorModel { Message = "Invalid relation name.", Key = "relationName" });
                response.Success = false;
                return DoResponse(response);
            }
            else
            {
                relation = new EntityRelationManager(service.StorageService).Read(model.RelationName).Object;
                if (relation == null)
                {
                    response.Errors.Add(new ErrorModel { Message = "Invalid relation name. No relation with that name.", Key = "relationName" });
                    response.Success = false;
                    return DoResponse(response);
                }
            }

            var originEntity = entMan.ReadEntity(relation.OriginEntityId).Object;
            var targetEntity = entMan.ReadEntity(relation.TargetEntityId).Object;
            var originField = originEntity.Fields.Single(x => x.Id == relation.OriginFieldId);
            var targetField = targetEntity.Fields.Single(x => x.Id == relation.TargetFieldId);

            if (model.DetachTargetFieldRecordIds != null && model.DetachTargetFieldRecordIds.Any() && targetField.Required && relation.RelationType != EntityRelationType.ManyToMany)
            {
                response.Errors.Add(new ErrorModel { Message = "Cannot detach records, when target field is required.", Key = "originFieldRecordId" });
                response.Success = false;
                return DoResponse(response);
            }

            EntityQuery query = new EntityQuery(originEntity.Name, "*", EntityQuery.QueryEQ("id", model.OriginFieldRecordId), null, null, null);
            QueryResponse result = recMan.Find(query);
            if (result.Object.Data.Count == 0)
            {
                response.Errors.Add(new ErrorModel { Message = "Origin record was not found. Id=[" + model.OriginFieldRecordId + "]", Key = "originFieldRecordId" });
                response.Success = false;
                return DoResponse(response);
            }

            var originRecord = result.Object.Data[0];
            object originValue = originRecord[originField.Name];

            List<EntityRecord> attachTargetRecords = new List<EntityRecord>();
            List<EntityRecord> detachTargetRecords = new List<EntityRecord>();

            foreach (var targetId in model.AttachTargetFieldRecordIds)
            {
                query = new EntityQuery(targetEntity.Name, "*", EntityQuery.QueryEQ("id", targetId), null, null, null);
                result = recMan.Find(query);
                if (result.Object.Data.Count == 0)
                {
                    response.Errors.Add(new ErrorModel { Message = "Attach target record was not found. Id=[" + targetEntity + "]", Key = "targetRecordId" });
                    response.Success = false;
                    return DoResponse(response);
                }
                else if (attachTargetRecords.Any(x => (Guid)x["id"] == targetId))
                {
                    response.Errors.Add(new ErrorModel { Message = "Attach target id was duplicated. Id=[" + targetEntity + "]", Key = "targetRecordId" });
                    response.Success = false;
                    return DoResponse(response);
                }
                attachTargetRecords.Add(result.Object.Data[0]);
            }

            foreach (var targetId in model.DetachTargetFieldRecordIds)
            {
                query = new EntityQuery(targetEntity.Name, "*", EntityQuery.QueryEQ("id", targetId), null, null, null);
                result = recMan.Find(query);
                if (result.Object.Data.Count == 0)
                {
                    response.Errors.Add(new ErrorModel { Message = "Detach target record was not found. Id=[" + targetEntity + "]", Key = "targetRecordId" });
                    response.Success = false;
                    return DoResponse(response);
                }
                else if (attachTargetRecords.Any(x => (Guid)x["id"] == targetId))
                {
                    response.Errors.Add(new ErrorModel { Message = "Detach target id was duplicated. Id=[" + targetEntity + "]", Key = "targetRecordId" });
                    response.Success = false;
                    return DoResponse(response);
                }
                detachTargetRecords.Add(result.Object.Data[0]);
            }

            var transaction = recMan.CreateTransaction();
            try
            {

                transaction.Begin();

                switch (relation.RelationType)
                {
                    case EntityRelationType.OneToOne:
                    case EntityRelationType.OneToMany:
                        {
                            foreach (var record in detachTargetRecords)
                            {
                                record[targetField.Name] = null;

                                var updResult = recMan.UpdateRecord(targetEntity, record);
                                if (!updResult.Success)
                                {
                                    transaction.Rollback();
                                    response.Errors = updResult.Errors;
                                    response.Message = "Target record id=[" + record["id"] + "] detach operation failed.";
                                    response.Success = false;
                                    return DoResponse(response);
                                }
                            }

                            foreach (var record in attachTargetRecords)
                            {
                                record[targetField.Name] = originValue;

                                var updResult = recMan.UpdateRecord(targetEntity, record);
                                if (!updResult.Success)
                                {
                                    transaction.Rollback();
                                    response.Errors = updResult.Errors;
                                    response.Message = "Target record id=[" + record["id"] + "] attach operation failed.";
                                    response.Success = false;
                                    return DoResponse(response);
                                }
                            }
                        }
                        break;
                    case EntityRelationType.ManyToMany:
                        {
                            foreach (var record in detachTargetRecords)
                            {
                                QueryResponse updResult = recMan.RemoveRelationManyToManyRecord(relation.Id, (Guid)originValue, (Guid)record[targetField.Name]);

                                if (!updResult.Success)
                                {
                                    transaction.Rollback();
                                    response.Errors = updResult.Errors;
                                    response.Message = "Target record id=[" + record["id"] + "] detach operation failed.";
                                    response.Success = false;
                                    return DoResponse(response);
                                }
                            }

                            foreach (var record in attachTargetRecords)
                            {
                                QueryResponse updResult = recMan.CreateRelationManyToManyRecord(relation.Id, (Guid)originValue, (Guid)record[targetField.Name]);

                                if (!updResult.Success)
                                {
                                    transaction.Rollback();
                                    response.Errors = updResult.Errors;
                                    response.Message = "Target record id=[" + record["id"] + "] attach  operation failed.";
                                    response.Success = false;
                                    return DoResponse(response);
                                }
                            }
                        }
                        break;
                    default:
                        {
                            transaction.Rollback();
                            throw new Exception("Not supported relation type");
                        }
                }

                transaction.Commit();
            }
            catch (Exception ex)
            {
                if (transaction != null)
                    transaction.Rollback();

                response.Success = false;
                response.Message = ex.Message;
                return DoResponse(response);
            }

            return DoResponse(response);
        }
Beispiel #14
0
        public void InitializeSystemEntities()
        {
            EntityResponse response = null;
            FieldResponse fieldResponse = null;
            EntityManager em = new EntityManager(StorageService);
            EntityRelationManager rm = new EntityRelationManager(StorageService);
            RecordManager recMan = new RecordManager(this);

            var transaction = recMan.CreateTransaction();

            try {

                transaction.Begin();

                IStorageSystemSettingsRepository systemSettingsRepository = StorageService.GetSystemSettingsRepository();
                IStorageSystemSettings storeSystemSettings = systemSettingsRepository.Read();

                Guid systemSettingsId = new Guid("F3223177-B2FF-43F5-9A4B-FF16FC67D186");
                SystemSettings systemSettings = new SystemSettings();
                systemSettings.Id = systemSettingsId;

                int currentVersion = 0;
                if (storeSystemSettings != null)
                {
                    systemSettings = new SystemSettings(storeSystemSettings);
                    currentVersion = systemSettings.Version;
                }

                EntityManager entityManager = new EntityManager(StorageService);

                //tmp code - during debug only
                //em.DeleteEntity(SystemIds.UserEntityId);
                //em.DeleteEntity(SystemIds.RoleEntityId);
                //rm.Delete(SystemIds.UserRoleRelationId);
                //currentVersion = 0;

                if (currentVersion < 150508)
                {
                    systemSettings.Version = 150508;

                    List<Guid> allowedRoles = new List<Guid>();
                    allowedRoles.Add(new Guid("F42EBA3B-6433-752B-6C34-B322A7B4CE7D"));

                    #region << create role entity >>

                    {
                        InputEntity roleEntity = new InputEntity();
                        roleEntity.Id = SystemIds.RoleEntityId;
                        roleEntity.Name = "role";
                        roleEntity.Label = "Role";
                        roleEntity.LabelPlural = "Roles";
                        roleEntity.System = true;
                        roleEntity.RecordPermissions = new RecordPermissions();
                        roleEntity.RecordPermissions.CanRead = allowedRoles;
                        roleEntity.RecordPermissions.CanCreate = allowedRoles;
                        roleEntity.RecordPermissions.CanUpdate = allowedRoles;
                        roleEntity.RecordPermissions.CanDelete = allowedRoles;

                        response = entityManager.CreateEntity(roleEntity);

                        InputTextField nameRoleField = new InputTextField();

                        nameRoleField.Id = new Guid("36F91EBD-5A02-4032-8498-B7F716F6A349");
                        nameRoleField.Name = "name";
                        nameRoleField.Label = "Name";
                        nameRoleField.PlaceholderText = "";
                        nameRoleField.Description = "The name of the role";
                        nameRoleField.HelpText = "";
                        nameRoleField.Required = true;
                        nameRoleField.Unique = false;
                        nameRoleField.Searchable = false;
                        nameRoleField.Auditable = false;
                        nameRoleField.System = true;
                        nameRoleField.DefaultValue = "";

                        nameRoleField.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(roleEntity.Id.Value, nameRoleField,false);

                        InputTextField descriptionRoleField = new InputTextField();

                        descriptionRoleField.Id = new Guid("4A8B9E0A-1C36-40C6-972B-B19E2B5D265B");
                        descriptionRoleField.Name = "description";
                        descriptionRoleField.Label = "Description";
                        descriptionRoleField.PlaceholderText = "";
                        descriptionRoleField.Description = "";
                        descriptionRoleField.HelpText = "";
                        descriptionRoleField.Required = true;
                        descriptionRoleField.Unique = false;
                        descriptionRoleField.Searchable = false;
                        descriptionRoleField.Auditable = false;
                        descriptionRoleField.System = true;
                        descriptionRoleField.DefaultValue = "";

                        descriptionRoleField.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(roleEntity.Id.Value, descriptionRoleField,false);
                    }

                    #endregion

                    #region << create user entity >>
                    {

                        InputEntity userEntity = new InputEntity();
                        userEntity.Id = SystemIds.UserEntityId;
                        userEntity.Name = "user";
                        userEntity.Label = "User";
                        userEntity.LabelPlural = "Users";
                        userEntity.System = true;
                        userEntity.RecordPermissions = new RecordPermissions();
                        userEntity.RecordPermissions.CanRead = allowedRoles;
                        userEntity.RecordPermissions.CanCreate = allowedRoles;
                        userEntity.RecordPermissions.CanUpdate = allowedRoles;
                        userEntity.RecordPermissions.CanDelete = allowedRoles;

                        response = entityManager.CreateEntity(userEntity);

                        InputTextField firstName = new InputTextField();

                        firstName.Id = new Guid("DF211549-41CC-4D11-BB43-DACA4C164411");
                        firstName.Name = "first_name";
                        firstName.Label = "First Name";
                        firstName.PlaceholderText = "";
                        firstName.Description = "First name of the user";
                        firstName.HelpText = "";
                        firstName.Required = true;
                        firstName.Unique = false;
                        firstName.Searchable = false;
                        firstName.Auditable = false;
                        firstName.System = true;
                        firstName.DefaultValue = "";

                        firstName.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, firstName,false);

                        InputTextField lastName = new InputTextField();

                        lastName.Id = new Guid("63E685B1-B2C6-4961-B393-2B6723EBD1BF");
                        lastName.Name = "last_name";
                        lastName.Label = "Last Name";
                        lastName.PlaceholderText = "";
                        lastName.Description = "Last name of the user";
                        lastName.HelpText = "";
                        lastName.Required = true;
                        lastName.Unique = false;
                        lastName.Searchable = false;
                        lastName.Auditable = false;
                        lastName.System = true;
                        lastName.DefaultValue = "";

                        lastName.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, lastName,false);

                        InputEmailField email = new InputEmailField();

                        email.Id = new Guid("9FC75C8F-CE80-4A64-81D7-E2BEFA5E4815");
                        email.Name = "email";
                        email.Label = "Email";
                        email.PlaceholderText = "";
                        email.Description = "Email address of the user";
                        email.HelpText = "";
                        email.Required = true;
                        email.Unique = true;
                        email.Searchable = false;
                        email.Auditable = false;
                        email.System = true;
                        email.DefaultValue = "";

                        email.MaxLength = 255;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, email,false);

                        InputPasswordField password = new InputPasswordField();

                        password.Id = new Guid("4EDE88D9-217A-4462-9300-EA0D6AFCDCEA");
                        password.Name = "password";
                        password.Label = "Password";
                        password.PlaceholderText = "";
                        password.Description = "Password for the user account";
                        password.HelpText = "";
                        password.Required = true;
                        password.Unique = true;
                        password.Searchable = false;
                        password.Auditable = false;
                        password.System = true;
                        password.MinLength = 6;
                        password.MaxLength = 24;
                        password.Encrypted = true;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, password, false);

                        InputDateTimeField lastLoggedIn = new InputDateTimeField();

                        lastLoggedIn.Id = new Guid("3C85CCEC-D526-4E47-887F-EE169D1F508D");
                        lastLoggedIn.Name = "last_logged_in";
                        lastLoggedIn.Label = "Last Logged In";
                        lastLoggedIn.PlaceholderText = "";
                        lastLoggedIn.Description = "";
                        lastLoggedIn.HelpText = "";
                        lastLoggedIn.Required = false;
                        lastLoggedIn.Unique = true;
                        lastLoggedIn.Searchable = false;
                        lastLoggedIn.Auditable = true;
                        lastLoggedIn.System = true;
                        lastLoggedIn.DefaultValue = null;

                        lastLoggedIn.Format = "MM/dd/YYYY";
                        lastLoggedIn.UseCurrentTimeAsDefaultValue = true;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, lastLoggedIn, false);

                        InputCheckboxField enabledField = new InputCheckboxField();

                        enabledField.Id = new Guid("C0C63650-7572-4252-8E4B-4E25C94897A6");
                        enabledField.Name = "enabled";
                        enabledField.Label = "Enabled";
                        enabledField.PlaceholderText = "";
                        enabledField.Description = "Shows if the user account is enabled";
                        enabledField.HelpText = "";
                        enabledField.Required = true;
                        enabledField.Unique = false;
                        enabledField.Searchable = false;
                        enabledField.Auditable = false;
                        enabledField.System = true;
                        enabledField.DefaultValue = false;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, enabledField,false);

                        InputCheckboxField verifiedUserField = new InputCheckboxField();

                        verifiedUserField.Id = new Guid("F1BA5069-8CC9-4E66-BCC3-60E33C79C265");
                        verifiedUserField.Name = "verified";
                        verifiedUserField.Label = "Verified";
                        verifiedUserField.PlaceholderText = "";
                        verifiedUserField.Description = "Shows if the user email is verified";
                        verifiedUserField.HelpText = "";
                        verifiedUserField.Required = true;
                        verifiedUserField.Unique = false;
                        verifiedUserField.Searchable = false;
                        verifiedUserField.Auditable = false;
                        verifiedUserField.System = true;
                        verifiedUserField.DefaultValue = false;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, verifiedUserField, false);
                    }

                    #endregion

                    #region << create user - role relation >>
                    {
                        var userEntity = em.ReadEntity(SystemIds.UserEntityId).Object;
                        var roleEntity = em.ReadEntity(SystemIds.RoleEntityId).Object;

                        EntityRelation userRoleRelation = new EntityRelation();
                        userRoleRelation.Id = SystemIds.UserRoleRelationId; ;
                        userRoleRelation.Name = "user_role";
                        userRoleRelation.Label = "User-Role";
                        userRoleRelation.System = true;
                        userRoleRelation.RelationType = EntityRelationType.ManyToMany;
                        userRoleRelation.TargetEntityId = userEntity.Id;
                        userRoleRelation.TargetFieldId = userEntity.Fields.Single(x => x.Name == "id").Id;
                        userRoleRelation.OriginEntityId = roleEntity.Id;
                        userRoleRelation.OriginFieldId = roleEntity.Fields.Single(x => x.Name == "id").Id;
                        {
                            var result = rm.Create(userRoleRelation);
                            if (!result.Success)
                                throw new Exception("CREATE USER-ROLE RELATION:" + result.Message);
                        }
                    }
                    #endregion

                    #region << create system records >>

                    {
                        EntityRecord user = new EntityRecord();
                        user["id"] = SystemIds.FirstUserId;
                        user["first_name"] = "WebVella";
                        user["last_name"] = "Erp";
                        user["password"] = "******";
                        user["email"] = "*****@*****.**";
                        user["created_by"] = SystemIds.FirstUserId;
                        user["last_modified_by"] = SystemIds.FirstUserId;
                        user["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("user", user);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST USER RECORD:" + result.Message);
                    }

                    {
                        EntityRecord adminRole = new EntityRecord();
                        adminRole["id"] = SystemIds.AdministratorRoleId;
                        adminRole["name"] = "Administrator";
                        adminRole["description"] = "";
                        adminRole["created_by"] = SystemIds.FirstUserId;
                        adminRole["last_modified_by"] = SystemIds.FirstUserId;
                        adminRole["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("role", adminRole);
                        if (!result.Success)
                            throw new Exception("CREATE ADMINITRATOR ROLE RECORD:" + result.Message);
                    }

                    {
                        EntityRecord regularRole = new EntityRecord();
                        regularRole["id"] = SystemIds.RegularRoleId;
                        regularRole["name"] = "Regular";
                        regularRole["description"] = "";
                        regularRole["created_by"] = SystemIds.FirstUserId;
                        regularRole["last_modified_by"] = SystemIds.FirstUserId;
                        regularRole["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("role", regularRole);
                        if (!result.Success)
                            throw new Exception("CREATE REGULAR ROLE RECORD:" + result.Message);
                    }

                    {
                        EntityRecord guestRole = new EntityRecord();
                        guestRole["id"] = SystemIds.GuestRoleId;
                        guestRole["name"] = "Guest";
                        guestRole["description"] = "";
                        guestRole["created_by"] = SystemIds.FirstUserId;
                        guestRole["last_modified_by"] = SystemIds.FirstUserId;
                        guestRole["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("role", guestRole);
                        if (!result.Success)
                            throw new Exception("CREATE GUEST ROLE RECORD:" + result.Message);
                    }

                    {
                        QueryResponse result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.FirstUserId, SystemIds.AdministratorRoleId);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST-USER <-> ADMINISTRATOR ROLE RELATION RECORD:" + result.Message);

                        result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.FirstUserId, SystemIds.RegularRoleId);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST-USER <-> REGULAR ROLE RELATION RECORD:" + result.Message);

                        result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.FirstUserId, SystemIds.GuestRoleId);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST-USER <-> GUEST ROLE RELATION RECORD:" + result.Message);
                    }

                    #endregion

                    #region << create Area entity >>
                    {
                        InputEntity areaEntity = new InputEntity();
                        areaEntity.Id = SystemIds.AreaEntityId;
                        areaEntity.Name = "area";
                        areaEntity.Label = "Area";
                        areaEntity.LabelPlural = "areas";
                        areaEntity.System = true;
                        areaEntity.IconName = "folder";
                        areaEntity.Weight = 10;
                        areaEntity.RecordPermissions = new RecordPermissions();
                        areaEntity.RecordPermissions.CanRead = allowedRoles;
                        areaEntity.RecordPermissions.CanCreate = allowedRoles;
                        areaEntity.RecordPermissions.CanUpdate = allowedRoles;
                        areaEntity.RecordPermissions.CanDelete = allowedRoles;
                        {
                            var createResponse = entityManager.CreateEntity(areaEntity);
                            if (!createResponse.Success)
                                throw new Exception("System error 10330. Message:" + createResponse.Message);
                        }

                        InputTextField color = new InputTextField();
                        color.Id = new Guid("2B4AACD9-3C34-4C44-B3A3-8AFF1520CFF6");
                        color.Name = "color";
                        color.Label = "Color";
                        color.PlaceholderText = "";
                        color.Description = "";
                        color.HelpText = "";
                        color.Required = true;
                        color.Unique = false;
                        color.Searchable = false;
                        color.Auditable = false;
                        color.System = true;
                        color.DefaultValue = "teal";
                        color.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, color, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField label = new InputTextField();
                        label.Id = new Guid("F050E7A1-AFB7-4346-B57B-1F12B2BD5AE5");
                        label.Name = "label";
                        label.Label = "Label";
                        label.PlaceholderText = "";
                        label.Description = "";
                        label.HelpText = "";
                        label.Required = true;
                        label.Unique = false;
                        label.Searchable = false;
                        label.Auditable = false;
                        label.System = true;
                        label.DefaultValue = "Default";
                        label.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, label, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField iconName = new InputTextField();
                        iconName.Id = new Guid("5EA0C872-D219-4D94-9EFA-C5DA978D316B");
                        iconName.Name = "icon_name";
                        iconName.Label = "Icon Name";
                        iconName.PlaceholderText = "";
                        iconName.Description = "";
                        iconName.HelpText = "";
                        iconName.Required = true;
                        iconName.Unique = false;
                        iconName.Searchable = false;
                        iconName.Auditable = false;
                        iconName.System = true;
                        iconName.DefaultValue = "database";
                        iconName.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, iconName, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputNumberField weight = new InputNumberField();
                        weight.Id = new Guid("9B169431-6C31-4141-80EB-5844B8333E63");
                        weight.Name = "weight";
                        weight.Label = "Weight";
                        weight.PlaceholderText = "";
                        weight.Description = "";
                        weight.HelpText = "";
                        weight.Required = true;
                        weight.Unique = false;
                        weight.Searchable = false;
                        weight.Auditable = false;
                        weight.System = true;
                        weight.DefaultValue = 10;
                        weight.MinValue = 0;
                        weight.DecimalPlaces = 2;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, weight, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField subscriptions = new InputTextField();
                        subscriptions.Id = new Guid("288EA657-C12C-4AC1-B701-81D6F9F39363");
                        subscriptions.Name = "subscriptions";
                        subscriptions.Label = "Subscriptions JSON String";
                        subscriptions.PlaceholderText = "";
                        subscriptions.Description = "Stringified Array of subscription objects";
                        subscriptions.HelpText = "";
                        subscriptions.Required = false;
                        subscriptions.Unique = false;
                        subscriptions.Searchable = false;
                        subscriptions.Auditable = false;
                        subscriptions.System = true;
                        subscriptions.DefaultValue = null;
                        subscriptions.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, subscriptions, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField name = new InputTextField();
                        name.Id = new Guid("F297577B-073E-4D18-81F3-675C1AFB466D");
                        name.Name = "name";
                        name.Label = "Name";
                        name.PlaceholderText = "";
                        name.Description = "";
                        name.HelpText = "";
                        name.Required = true;
                        name.Unique = false;
                        name.Searchable = false;
                        name.Auditable = false;
                        name.System = true;
                        name.DefaultValue = "default";
                        name.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, name, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField roles = new InputTextField();
                        roles.Id = new Guid("8E486F76-D0C1-4D0E-8617-9EF868BF1C55");
                        roles.Name = "roles";
                        roles.Label = "Subscriptions JSON String";
                        roles.PlaceholderText = "";
                        roles.Description = "Stringified Array of roles that have access to this area";
                        roles.HelpText = "";
                        roles.Required = false;
                        roles.Unique = false;
                        roles.Searchable = false;
                        roles.Auditable = false;
                        roles.System = true;
                        roles.DefaultValue = null;
                        roles.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, roles, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                    }
                    #endregion
                }

                storeSystemSettings = systemSettingsRepository.Convert(systemSettings);
                systemSettingsRepository.Save(storeSystemSettings);

                //if (currentVersion == 150508) //update to 150510
                //{
                //    systemSettings.Version = 150510;

                //    storeSystemSettings = systemSettingsRepository.Convert(systemSettings);
                //    systemSettingsRepository.Save(storeSystemSettings);
                //}

                transaction.Commit();
            }
            catch( Exception )
            {
                transaction.Rollback();
                throw;
            }
        }
Beispiel #15
0
        private static void Patch160613(EntityManager entMan, EntityRelationManager relMan, RecordManager recMan, bool createSampleRecords = false)
        {
            #region << Update  Enity: wv_project_comment name: task_comments >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "task_comments").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "task_comments";
                createListInput.Label = "Comments";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "comments-o";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("0");
                createListInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/task-comments.html";
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = "";
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("c205c60f-598a-4db7-bd41-a7fd2ae3abd0");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                        listItemFromRelation.RelationName = "user_wv_project_comment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << content >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("23afb07b-438f-4e31-9372-c850a5789cc6");
                        listField.FieldName = "content";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                        listItemFromRelation.RelationName = "user_wv_project_comment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_by >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("46208807-7bc8-4f54-8618-45134189e763");
                        listField.FieldName = "created_by";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "created_on";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated list: task_comments Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug View: general >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "general").Id;
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "[{code}] {subject}";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "bug";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = "";
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("b3679dee-d30d-46d7-b5ac-300ed8f1e922");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("f9099d26-96ad-4fe2-9c81-db7a8f5daa47");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("8");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion

                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("4afe9621-39ee-40b9-a3ef-cb9b98131a6a");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << List from relation: bug_comments >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationListItem();
                                    viewItemFromRelation.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                                    viewItemFromRelation.EntityName = "wv_project_comment";
                                    viewItemFromRelation.ListId = new Guid("b143b82f-b79f-47c1-87e7-ecba6f6f2a32");
                                    viewItemFromRelation.ListName = "bug_comments";
                                    viewItemFromRelation.FieldLabel = "Comments";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = "";
                                    viewItemFromRelation.FieldRequired = false;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("5af026bd-d046-42ba-b6a0-e9090727348f");
                                    viewItemFromRelation.RelationName = "bug_1_n_comment";
                                    viewItemFromRelation.Type = "listFromRelation";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("4");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("d94f100c-024c-47e7-af32-d67a49be2b6c");
                                    viewItemFromRelation.RelationName = "project_1_n_bug";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Owner";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                                    viewItemFromRelation.RelationName = "user_1_n_bug_owner";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Watchers";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("b71d0c52-1626-48da-91bc-e10999ba79b8");
                                    viewItemFromRelation.RelationName = "user_n_n_bug_watchers";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #region << list from relation: bug_attachments >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("2b83e4e3-6878-4b5b-9391-6e59429c0b5e");
                    viewItemFromRelation.ListName = "bug_attachments";
                    viewItemFromRelation.FieldLabel = "Attachments";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("a4f60f87-66a9-4541-a2ef-29e00f2b418b");
                    viewItemFromRelation.RelationName = "bug_1_n_attachment";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: bug_timelogs >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("f9a12626-08db-4fd2-a443-b521162be2b5");
                    viewItemFromRelation.ListName = "bug_timelogs";
                    viewItemFromRelation.FieldLabel = "Time logs";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("97909e49-50d4-4534-aa7b-61c523b55d87");
                    viewItemFromRelation.RelationName = "bug_1_n_time_log";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: bug_activities >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("57c3062c-df6e-488a-a432-dd927b0dd013");
                    viewItemFromRelation.ListName = "bug_activities";
                    viewItemFromRelation.FieldLabel = "Activities";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("b96189f7-a880-4da4-b9a9-2274a9745d2d");
                    viewItemFromRelation.RelationName = "bug_1_n_activity";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << Create  Enity: wv_task field: estimation >>
            {
                InputNumberField numberField = new InputNumberField();
                numberField.Id = new Guid("848e2a24-8d58-451b-9cf8-9ba1254a169a");
                numberField.Name = "estimation";
                numberField.Label = "Estimation";
                numberField.PlaceholderText = "";
                numberField.Description = "";
                numberField.HelpText = "";
                numberField.Required = true;
                numberField.Unique = false;
                numberField.Searchable = false;
                numberField.Auditable = false;
                numberField.System = false;
                numberField.DefaultValue = Decimal.Parse("0.0");
                numberField.MinValue = null;
                numberField.MaxValue = null;
                numberField.DecimalPlaces = byte.Parse("2");
                numberField.EnableSecurity = false;
                numberField.Permissions = new FieldPermissions();
                numberField.Permissions.CanRead = new List<Guid>();
                numberField.Permissions.CanUpdate = new List<Guid>();
                //READ
                //UPDATE
                {
                    var response = entMan.CreateField(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), numberField, false);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Field: estimation Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("8b628f5d-16b3-49d0-a433-a910ea208b39");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("818f516c-f6c2-4073-8574-75c13a72aee4");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817");
                                    viewItemFromRelation.RelationName = "project_1_n_task";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("a00eb247-918a-46ba-9869-8d1168ea8f45");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        #region << Row 2>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("2144c60b-4974-44e2-86ef-5ceec72d04f8");
                            viewRow.Weight = Decimal.Parse("2.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << estimation >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("848e2a24-8d58-451b-9cf8-9ba1254a169a");
                                    viewItem.FieldName = "estimation";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task View: general >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "general").Id;
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "[{code}] {subject}";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "tasks";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = "";
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("0289b876-b6be-4d5f-915b-22dc0428bc25");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("cbf260ae-07e3-4e66-be57-beb7a36779bf");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("8");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion

                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("a00eb247-918a-46ba-9869-8d1168ea8f45");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion

                                #region << List from relation: task_comments >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationListItem();
                                    viewItemFromRelation.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                                    viewItemFromRelation.EntityName = "wv_project_comment";
                                    viewItemFromRelation.ListId = new Guid("b8a7a81d-9176-47e6-90c5-3cabc2a4ceff");
                                    viewItemFromRelation.ListName = "task_comments";
                                    viewItemFromRelation.FieldLabel = "Comments";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = "";
                                    viewItemFromRelation.FieldRequired = false;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("884b9480-dc1c-468a-98f0-2d5f10084622");
                                    viewItemFromRelation.RelationName = "task_1_n_comment";
                                    viewItemFromRelation.Type = "listFromRelation";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("4");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << View: project_milestone >>
                                {
                                    var viewItem = new InputRecordViewViewItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.ViewId = new Guid("820b6771-3100-4393-982b-3813d79f4df2");
                                    viewItem.ViewName = "project_milestone";
                                    viewItem.Type = "view";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << estimation >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("848e2a24-8d58-451b-9cf8-9ba1254a169a");
                                    viewItem.FieldName = "estimation";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Owner";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                                    viewItemFromRelation.RelationName = "user_1_n_task_owner";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Watchers";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("de7e1578-8f8f-4454-a954-0fb62d3bf425");
                                    viewItemFromRelation.RelationName = "user_n_n_task_watchers";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion

                    #region << Section: hidden >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("23557322-9c2c-4824-b817-9d4d5bc0e83b");
                        viewSection.Name = "hidden";
                        viewSection.Label = "Hidden";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "ng-hide";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("2.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("19c54fd0-b594-4e96-a727-adac8518fd38");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << code >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                                    viewItem.FieldName = "code";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #region << list from relation: task_attachments >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("6fc374ac-ba6b-4009-ade4-988304071f29");
                    viewItemFromRelation.ListName = "task_attachments";
                    viewItemFromRelation.FieldLabel = "Attachments";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("f79f76e2-06b1-463a-9675-63845814bf22");
                    viewItemFromRelation.RelationName = "task_1_n_attachment";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: task_timelogs >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("c105b3f8-e140-4150-a587-a31cf600d99b");
                    viewItemFromRelation.ListName = "task_timelogs";
                    viewItemFromRelation.FieldLabel = "Time logs";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("61f1cd54-bcd6-4061-9c96-7934e01f0857");
                    viewItemFromRelation.RelationName = "task_1_n_time_log";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: task_activities >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("121ce540-7838-4459-8357-d0d0ad2b65a4");
                    viewItemFromRelation.ListName = "task_activities";
                    viewItemFromRelation.FieldLabel = "Activities";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("8f294277-fd60-496e-bff7-9391fffcda41");
                    viewItemFromRelation.RelationName = "task_1_n_activity";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: general Message:" + response.Message);
                }
            }
            #endregion
        }
Beispiel #16
0
        private List<ResponseTreeNode> GetTreeNodeChildren(string entityName, string fields, string idFieldName, string parentIdFieldName,
				string nameFieldName, string labelFieldName, Guid? nodeId, string weightFieldName = "no-weight", int depth = 1 , int maxDepth = 20 )
        {
            if (depth >= maxDepth)
                return new List<ResponseTreeNode>();

            var query = EntityQuery.QueryEQ(parentIdFieldName, nodeId);
            EntityQuery eq = new EntityQuery(entityName, fields, query);
            RecordManager recMan = new RecordManager(service);
            var records = recMan.Find(eq).Object.Data;
            List<ResponseTreeNode> nodes = new List<ResponseTreeNode>();
            depth++;
            foreach (var record in records)
            {
                if(weightFieldName == "no-weight") {
                    nodes.Add(new ResponseTreeNode
                    {
                        RecordId = (Guid)record["id"],
                        Id = (Guid)record[idFieldName],
                        ParentId = (Guid?)record[parentIdFieldName],
                        Name = record[nameFieldName]?.ToString(),
                        Label = record[labelFieldName]?.ToString(),
                        Weight = null,
                        Nodes = GetTreeNodeChildren(entityName,fields,idFieldName,parentIdFieldName, nameFieldName,labelFieldName,(Guid)record[idFieldName], weightFieldName, depth, maxDepth)
                    });
                }
                else {
                    nodes.Add(new ResponseTreeNode
                    {
                        RecordId = (Guid)record["id"],
                        Id = (Guid)record[idFieldName],
                        ParentId = (Guid?)record[parentIdFieldName],
                        Name = record[nameFieldName]?.ToString(),
                        Label = record[labelFieldName]?.ToString(),
                        Weight = (int?)((decimal?)record[weightFieldName]),
                        Nodes = GetTreeNodeChildren(entityName,fields,idFieldName,parentIdFieldName, nameFieldName,labelFieldName,(Guid)record[idFieldName], weightFieldName, depth, maxDepth)
                    });
                }
            }
            if(weightFieldName == "no-weight") {
                return nodes.OrderBy(x => x.Name).ToList();
            }
            else {
                return nodes.OrderBy(x => x.Weight).ThenBy(y => y.Name).ToList();
            }
        }
Beispiel #17
0
        private static void Patch160430(EntityManager entMan, EntityRelationManager relMan, RecordManager recMan, bool createSampleRecords = false)
        {
            #region << Create Project admin area >>
            //The areas are the main object for navigation for the user. You can attach entities and URLs later to them
            {
                var area = new EntityRecord();
                area["id"] = PROJECT_ADMIN_AREA_ID;
                area["name"] = "project_admin";
                area["label"] = "Project Admin";
                area["icon_name"] = "wrench";
                area["color"] = "pink";
                area["folder"] = "Admin";
                area["weight"] = 101;
                var areaRoles = new List<Guid>();
                areaRoles.Add(SystemIds.AdministratorRoleId);
                area["roles"] = JsonConvert.SerializeObject(areaRoles);
                var createAreaResult = recMan.CreateRecord("area", area);
                if (!createAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area create with name : project_admin. Message:" + createAreaResult.Message);
                }
            }
            #endregion

            #region << Create Project Workplace area >>
            //The areas are the main object for navigation for the user. You can attach entities and URLs later to them
            {
                var area = new EntityRecord();
                area["id"] = PROJECT_WORKPLACE_AREA_ID;
                area["name"] = "projects";
                area["label"] = "Projects";
                area["icon_name"] = "product-hunt";
                area["color"] = "indigo";
                area["folder"] = "Projects";
                area["weight"] = 5;
                var areaRoles = new List<Guid>();
                areaRoles.Add(SystemIds.AdministratorRoleId);
                areaRoles.Add(SystemIds.RegularRoleId);
                area["roles"] = JsonConvert.SerializeObject(areaRoles);
                var createAreaResult = recMan.CreateRecord("area", area);
                if (!createAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area create with name : project_admin. Message:" + createAreaResult.Message);
                }
            }
            #endregion

            #region << Create Project create task area >>
            {
                var area = new EntityRecord();
                area["id"] = CREATE_TASK_WORKPLACE_AREA_ID;
                area["name"] = "create_task";
                area["label"] = "Create task";
                area["icon_name"] = "tasks";
                area["color"] = "teal";
                area["folder"] = "Projects";
                area["weight"] = 1;
                var areaRoles = new List<Guid>();
                areaRoles.Add(SystemIds.AdministratorRoleId);
                areaRoles.Add(SystemIds.RegularRoleId);
                area["roles"] = JsonConvert.SerializeObject(areaRoles);
                var createAreaResult = recMan.CreateRecord("area", area);
                if (!createAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area create with name : project_admin. Message:" + createAreaResult.Message);
                }
            }
            #endregion

            #region << area add subscription: Create task >>
            {
                var updatedAreaId = CREATE_TASK_WORKPLACE_AREA_ID;
                var updateAreaResult = Helpers.UpsertUrlAsAreaSubscription(entMan, recMan, updatedAreaId, "/#/areas/projects/wv_task/view-create/create?returnUrl=%2Fareas%2Fprojects%2Fwv_task%2Flist-general%2Fmy_tasks", "Create task", 1, "tasks");
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << Create Project submit bug area >>
            {
                var area = new EntityRecord();
                area["id"] = REPORT_BUG_WORKPLACE_AREA_ID;
                area["name"] = "report_bug";
                area["label"] = "Report bug";
                area["icon_name"] = "bug";
                area["color"] = "deep-orange";
                area["folder"] = "Projects";
                area["weight"] = 2;
                var areaRoles = new List<Guid>();
                areaRoles.Add(SystemIds.AdministratorRoleId);
                areaRoles.Add(SystemIds.RegularRoleId);
                area["roles"] = JsonConvert.SerializeObject(areaRoles);
                var createAreaResult = recMan.CreateRecord("area", area);
                if (!createAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area create with name : project_admin. Message:" + createAreaResult.Message);
                }
            }
            #endregion

            #region << area add subscription: Create task >>
            {
                var updatedAreaId = REPORT_BUG_WORKPLACE_AREA_ID;
                var updateAreaResult = Helpers.UpsertUrlAsAreaSubscription(entMan, recMan, updatedAreaId, "/#/areas/projects/wv_bug/view-create/create?returnUrl=%2Fareas%2Fprojects%2Fwv_bug%2Flist-general%2Fmy_bugs", "Report bug", 1, "bug");
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << wv_project >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = PROJECT_ENTITY_ID;
                    entity.Name = PROJECT_ENTITY_NAME;
                    entity.Label = "Project";
                    entity.LabelPlural = "Projects";
                    entity.System = true;
                    entity.IconName = "product-hunt";
                    entity.Weight = 22;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("979dc238-c8f2-46c9-90e7-6ab65f9652da");
                    systemItemIdDictionary["created_on"] = new Guid("64c613a5-354b-4cc3-8ba7-2ece7be562f0");
                    systemItemIdDictionary["created_by"] = new Guid("5125750c-f82c-4320-905a-804d7c32d3fd");
                    systemItemIdDictionary["last_modified_on"] = new Guid("58cad35e-39b6-4ce7-9e2b-610cd466141e");
                    systemItemIdDictionary["last_modified_by"] = new Guid("292cd102-7915-4a3b-85a7-5ffdc5afe4e2");
                    systemItemIdDictionary["user_wv_project_created_by"] = new Guid("330c72a0-fcce-4c63-979d-8cfad63fa6f5");
                    systemItemIdDictionary["user_wv_project_modified_by"] = new Guid("d99cfe44-68a8-4e66-9e92-1a484fb73bd8");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + PROJECT_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << name >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                    textboxField.Name = "name";
                    textboxField.Label = "Name";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: name" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << code >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("d9c6a939-e2e3-4617-900e-e056f0638fa8");
                    textboxField.Name = "code";
                    textboxField.Label = "Code";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: code" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << description >>
                {
                    InputHtmlField htmlField = new InputHtmlField();
                    htmlField.Id = new Guid("d5e2c42c-c0b8-4f03-92e0-e91bede1e7b3");
                    htmlField.Name = "description";
                    htmlField.Label = "Description";
                    htmlField.PlaceholderText = "";
                    htmlField.Description = "";
                    htmlField.HelpText = "";
                    htmlField.Required = false;
                    htmlField.Unique = false;
                    htmlField.Searchable = false;
                    htmlField.Auditable = false;
                    htmlField.System = true;
                    htmlField.DefaultValue = string.Empty;
                    htmlField.EnableSecurity = true;
                    htmlField.Permissions = new FieldPermissions();
                    htmlField.Permissions.CanRead = new List<Guid>();
                    htmlField.Permissions.CanUpdate = new List<Guid>();
                    htmlField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    htmlField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, htmlField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: description" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << owner_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("2e8589e0-3966-447d-8d21-6fd9a1250d60");
                    guidField.Name = "owner_id";
                    guidField.Label = "Project owner";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: owner_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << start_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("417ce7d7-a472-499b-8e70-43a1cb54723d");
                    dateField.Name = "start_date";
                    dateField.Label = "Start date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = false;
                    dateField.Unique = false;
                    dateField.Searchable = false;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: start_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << end_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("57198778-636d-47ec-b33e-edfc5705cc05");
                    dateField.Name = "end_date";
                    dateField.Label = "End date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = false;
                    dateField.Unique = false;
                    dateField.Searchable = false;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: end_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << priority >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("277feafe-5727-4a33-9024-153015dd06d0");
                    dropdownField.Name = "priority";
                    dropdownField.Label = "Priority";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = false;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "medium";
                    dropdownField.Options = new List<SelectFieldOption>
                                        {
                                            new SelectFieldOption(){ Key = "low", Value = "low" },
                                            new SelectFieldOption(){ Key = "medium", Value = "medium" },
                                            new SelectFieldOption(){ Key = "hight", Value = "hight" }
                                        };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: priority" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << status >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("ba5698ba-fa81-4215-a5e1-17c368f504e2");
                    dropdownField.Name = "status";
                    dropdownField.Label = "Status";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = false;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "draft";
                    dropdownField.Options = new List<SelectFieldOption>
                                {
                                    new SelectFieldOption(){ Key = "draft", Value = "draft" },
                                    new SelectFieldOption(){ Key = "in review", Value = "in review" },
                                    new SelectFieldOption(){ Key = "published", Value = "published" },
                                    new SelectFieldOption(){ Key = "archived", Value = "archived" }
                                };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: status" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << billable_hour_price >>
                {
                    InputCurrencyField currencyField = new InputCurrencyField();
                    currencyField.Id = new Guid("7179f4ab-0376-4ded-a334-a21ff451538e");
                    currencyField.Name = "billable_hour_price";
                    currencyField.Label = "billable_hour_price";
                    currencyField.PlaceholderText = "";
                    currencyField.Description = "";
                    currencyField.HelpText = "";
                    currencyField.Required = true;
                    currencyField.Unique = false;
                    currencyField.Searchable = false;
                    currencyField.Auditable = false;
                    currencyField.System = true;
                    currencyField.DefaultValue = 0;
                    currencyField.MinValue = 0;
                    currencyField.Currency = Helpers.GetCurrencyTypeObject("USD");
                    currencyField.EnableSecurity = true;
                    currencyField.Permissions.CanRead = new List<Guid>();
                    currencyField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    currencyField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    //UPDATE
                    currencyField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, currencyField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: billable_hour_price" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << customer_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("6aec7d63-56f3-4f1d-b2df-5fb62e30ab74");
                    guidField.Name = "customer_id";
                    guidField.Label = "Customer";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: customer_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_milestones_opened >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("83a2c903-454f-480d-9709-9903ad7a4046");
                    numberField.Name = "x_milestones_opened";
                    numberField.Label = "x_milestones_opened";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_milestones_opened" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_milestones_completed >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("635c2bb3-d141-4eb2-8dce-2d76d9bf0fc3");
                    numberField.Name = "x_milestones_completed";
                    numberField.Label = "x_milestones_completed";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_milestones_completed" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_tasks_not_started >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("589ad094-3d99-4f85-a35f-6e02c2b2073c");
                    numberField.Name = "x_tasks_not_started";
                    numberField.Label = "x_tasks_not_started";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_tasks_not_started" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_tasks_in_progress >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("cbc72ef7-b0ac-4952-af75-df65e8a560ea");
                    numberField.Name = "x_tasks_in_progress";
                    numberField.Label = "x_tasks_in_progress";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_tasks_in_progress" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_tasks_completed >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("abd6b885-d095-4dc4-ad26-d47bd565abcd");
                    numberField.Name = "x_tasks_completed";
                    numberField.Label = "x_tasks_completed";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_tasks_completed" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_bugs_opened >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("45222a14-313c-450f-8988-f386895753ba");
                    numberField.Name = "x_bugs_opened";
                    numberField.Label = "x_bugs_opened";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_bugs_opened" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_bugs_reopened >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("9eee5691-1837-4187-8d65-3b6629c51bf7");
                    numberField.Name = "x_bugs_reopened";
                    numberField.Label = "x_bugs_reopened";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_bugs_reopened" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_bugs_closed >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("41507552-2b75-43d5-98b7-63552e9fa420");
                    numberField.Name = "x_bugs_closed";
                    numberField.Label = "x_bugs_closed";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(PROJECT_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Field: x_bugs_closed" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << user_1_n_project_owner Relation >>
                {
                    var originEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = PROJECT_RELATION_USER_1_N_PROJECT_OWNER_ID;
                    oneToNRelation.Name = "user_1_n_project_owner";
                    oneToNRelation.Label = "user_1_n_project_owner";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "owner_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE user_1_n_project_owner RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << customer_1_n_project Relation >>
                {
                    var originEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = PROJECT_RELATION_CUSTOMER_1_N_PROJECT_ID;
                    oneToNRelation.Name = "customer_1_n_project";
                    oneToNRelation.Label = "customer_1_n_project";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "customer_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE customer_1_n_project RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << role_n_n_project_team Relation >>
                //Relation for the team user roles for this projects
                {
                    var originEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                    var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    EntityRelation NToNRelation = new EntityRelation();
                    NToNRelation.Id = PROJECT_RELATION_ROLE_N_N_PROJECT_TEAM_ID;
                    NToNRelation.Name = "role_n_n_project_team";
                    NToNRelation.Label = "role_n_n_project_team";
                    NToNRelation.System = true;
                    NToNRelation.RelationType = EntityRelationType.ManyToMany;
                    NToNRelation.OriginEntityId = originEntity.Id;
                    NToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    NToNRelation.TargetEntityId = targetEntity.Id;
                    NToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "id").Id;
                    {
                        var result = relMan.Create(NToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE role_n_n_project_team RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << role_n_n_project_customer Relation >>
                //Relation for the customer user roles for this projects
                {
                    var originEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                    var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    EntityRelation NToNRelation = new EntityRelation();
                    NToNRelation.Id = new Guid("e6d75feb-3c8f-410b-9ff4-54ef8489dc2f");
                    NToNRelation.Name = "role_n_n_project_customer";
                    NToNRelation.Label = "role_n_n_project_customer";
                    NToNRelation.System = true;
                    NToNRelation.RelationType = EntityRelationType.ManyToMany;
                    NToNRelation.OriginEntityId = originEntity.Id;
                    NToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    NToNRelation.TargetEntityId = targetEntity.Id;
                    NToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "id").Id;
                    {
                        var result = relMan.Create(NToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE role_n_n_project_customer RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << View name: admin_details >>
                {
                    var createViewEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewRegion = new InputRecordViewRegion();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();

                    #region << details >>
                    createViewInput.Id = new Guid("120dee5b-f3ed-4256-9346-da01d787a49c");
                    createViewInput.Type = "hidden";
                    createViewInput.Name = "admin_details";
                    createViewInput.Label = "Project details";
                    createViewInput.Title = "";
                    createViewInput.Default = false;
                    createViewInput.System = true;
                    createViewInput.Weight = 10;
                    createViewInput.CssClass = "";
                    createViewInput.IconName = "product-hunt";
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    createViewInput.ServiceCode = null;
                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    #endregion

                    #region << Header Region >>
                    viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = 1;
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("6f8fdcc2-8a8f-4cf6-bf26-47bf1c6f0438");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 Column>>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("5d7ce054-f592-41e7-b8f1-424cfd6d38b7");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << description >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    #region << Row 2 Columns>>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("22d11cfc-a763-472b-b509-7ddfe36476bb");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column Left >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << $user_1_n_project_owner > username >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                        viewItemFromRelation.FieldName = "username";
                        viewItemFromRelation.FieldLabel = "Owner / Project manager";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_USER_1_N_PROJECT_OWNER_ID;
                        viewItemFromRelation.RelationName = "user_1_n_project_owner";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << $role_n_n_project_team > name >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project team roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_ROLE_N_N_PROJECT_TEAM_ID;
                        viewItemFromRelation.RelationName = "role_n_n_project_team";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "start_date").Id;
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << billable_hour_price >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "billable_hour_price").Id;
                        viewItem.FieldName = "billable_hour_price";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column right >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << $customer_1_n_project > name >>
                    {
                        var targetEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Customer";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_CUSTOMER_1_N_PROJECT_ID;
                        viewItemFromRelation.RelationName = "customer_1_n_project";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << $role_n_n_project_customer > name >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project customer roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_ROLE_N_N_PROJECT_CUSTOMER_ID;
                        viewItemFromRelation.RelationName = "role_n_n_project_customer";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "end_date").Id;
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << code >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "code").Id;
                        viewItem.FieldName = "code";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    viewRegion.Sections.Add(viewSection);
                    #endregion

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                    #endregion

                    #region << relation options >>
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sidebar >>
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    #region << action items >>
                    createViewInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
                                        ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
                                    <i class=""fa fa-trash go-red""></i> Delete Record
                                </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion
                    {
                        var response = entMan.CreateRecordView(PROJECT_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated view: admin_details" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << View name: admin_create >>
                {
                    var createViewEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewRegion = new InputRecordViewRegion();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();

                    #region << details >>
                    createViewInput.Id = new Guid("a6e121f5-0990-4576-9e39-59777e0ecb01");
                    createViewInput.Type = "hidden";
                    createViewInput.Title = "";
                    createViewInput.Name = "admin_create";
                    createViewInput.Label = "Project create";
                    createViewInput.Default = false;
                    createViewInput.System = true;
                    createViewInput.Weight = 10;
                    createViewInput.CssClass = null;
                    createViewInput.IconName = "product-hunt";
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    createViewInput.ServiceCode = null;
                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    #endregion

                    #region << Header Region >>
                    viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = 1;
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("88077697-7a36-4a5a-b021-3d2a8638dade");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 Column>>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("cc65d58f-0cfd-4f3d-b9c6-3c8faff6c8b4");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << description >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    #region << Row 2 Columns>>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("d88b3da7-d501-48ba-b61d-2eb3485bce21");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column Left >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << $user_1_n_project_owner > username >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                        viewItemFromRelation.FieldName = "username";
                        viewItemFromRelation.FieldLabel = "Owner / Project manager";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_USER_1_N_PROJECT_OWNER_ID;
                        viewItemFromRelation.RelationName = "user_1_n_project_owner";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << $role_n_n_project_team > name >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project team roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_ROLE_N_N_PROJECT_TEAM_ID;
                        viewItemFromRelation.RelationName = "role_n_n_project_team";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "start_date").Id;
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << billable_hour_price >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "billable_hour_price").Id;
                        viewItem.FieldName = "billable_hour_price";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column right >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << $customer_1_n_project > name >>
                    {
                        var targetEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Customer";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_CUSTOMER_1_N_PROJECT_ID;
                        viewItemFromRelation.RelationName = "customer_1_n_project";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << $role_n_n_project_customer > name >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "field";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project customer roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = PROJECT_RELATION_ROLE_N_N_PROJECT_CUSTOMER_ID;
                        viewItemFromRelation.RelationName = "role_n_n_project_customer";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "end_date").Id;
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << code >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = PROJECT_ENTITY_ID;
                        viewItem.EntityName = PROJECT_ENTITY_NAME;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "code").Id;
                        viewItem.FieldName = "code";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    viewRegion.Sections.Add(viewSection);
                    #endregion

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                    #endregion

                    #region << relation options >>
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sidebar >>
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    #region << action items >>
                    createViewInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();

                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = 2;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = 3;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion
                    {
                        var response = entMan.CreateRecordView(PROJECT_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated view: admin_create" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << View name: dashboard >>
                {
                    var createViewEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewRegion = new InputRecordViewRegion();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();

                    #region << details >>
                    createViewInput.Id = new Guid("68402d13-d9e7-4fb3-9394-40ba598f3f1a");
                    createViewInput.Type = "general";
                    createViewInput.Name = "dashboard";
                    createViewInput.Label = "[{code}] {name}";
                    createViewInput.Title = "";
                    createViewInput.Default = false;
                    createViewInput.System = true;
                    createViewInput.Weight = 10;
                    createViewInput.CssClass = null;
                    createViewInput.IconName = "tachometer";
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    createViewInput.ServiceCode = null;
                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    #endregion

                    #region << Header Region >>
                    viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = 1;
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                    #endregion

                    #region << relation options >>
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sidebar >>
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    #region << action items >>
                    createViewInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
                                        ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
                                    <i class=""fa fa-trash go-red""></i> Delete Record
                                </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion
                    {
                        var response = entMan.CreateRecordView(PROJECT_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated view: admin_details" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: admin >>
                {
                    var createListEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listItem = new InputRecordListFieldItem();
                    var listItemFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("3eff91d7-152a-496c-913c-152819a42930");
                    createListInput.Type = "hidden";
                    createListInput.Name = "admin";
                    createListInput.Label = "All Projects";
                    createListInput.Weight = 1;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "product-hunt";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = null;
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();
                    #region << field_name >>
                    {
                        var fieldName = "name";
                        listItem = new InputRecordListFieldItem();
                        listItem.EntityId = PROJECT_ENTITY_ID;
                        listItem.EntityName = PROJECT_ENTITY_NAME;
                        listItem.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listItem.FieldName = fieldName;
                        listItem.Type = "field";
                        createListInput.Columns.Add(listItem);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    listQuery = new InputRecordListQuery();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    #endregion
                    {
                        var response = entMan.CreateRecordList(PROJECT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated List: admin" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create project my projects list>>
                {
                    var createListEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listItem = new InputRecordListFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    //General list details
                    createListInput.Id = new Guid("86f56bb1-9cf4-4168-8e0e-3e8c4d8dd0e6");
                    createListInput.Name = "my_projects";
                    createListInput.Label = "My Projects";
                    createListInput.Default = true;
                    createListInput.System = true;
                    createListInput.Type = "general";
                    createListInput.IconName = "product-hunt";
                    createListInput.PageSize = 10;
                    createListInput.Weight = 10;
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ServiceCode = null;
                    createListInput.DataSourceUrl = "/plugins/webvella-projects/api/project/list/my-projects";
                    createListInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/my-projects.html";
                    createListInput.ActionItems = new List<ActionItem>();
                    createListInput.Columns = new List<InputRecordListItemBase>();
                    //Fields

                    #region << field_name >>
                    listItem = new InputRecordListFieldItem();
                    listItem.EntityId = PROJECT_ENTITY_ID;
                    listItem.EntityName = PROJECT_ENTITY_NAME;
                    listItem.FieldId = createListEntity.Fields.Single(x => x.Name == "name").Id;
                    listItem.FieldName = "name";
                    listItem.Type = "field";
                    createListInput.Columns.Add(listItem);
                    #endregion

                    {
                        var response = entMan.CreateRecordList(PROJECT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated List: general" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << area add subscription: Project Admin -> Project >>
                {
                    var updatedAreaId = PROJECT_ADMIN_AREA_ID;
                    var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, PROJECT_ENTITY_NAME, "admin_details", "admin_create", "admin");
                    if (!updateAreaResult.Success)
                    {
                        throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                    }
                }
                #endregion

                #region << create project lookup list >>
                {
                    var createListEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listItem = new InputRecordListFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();
                    //General list details
                    createListInput.Id = new Guid("623c9a45-9472-418c-a293-e508d0b91117");
                    createListInput.Name = "lookup";
                    createListInput.Label = "Lookup";
                    createListInput.Default = true;
                    createListInput.System = true;
                    createListInput.Type = "lookup";
                    createListInput.IconName = "list";
                    createListInput.PageSize = 10;
                    createListInput.Weight = 10;
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ServiceCode = null;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = "/plugins/webvella-projects/api/project/list/my-projects";
                    createListInput.ActionItems = new List<ActionItem>();
                    createListInput.Columns = new List<InputRecordListItemBase>();
                    //Fields
                    #region << field_name >>
                    listItem = new InputRecordListFieldItem();
                    listItem.EntityId = PROJECT_ENTITY_ID;
                    listItem.EntityName = PROJECT_ENTITY_NAME;
                    listItem.FieldId = createListEntity.Fields.Single(x => x.Name == "name").Id;
                    listItem.FieldName = "name";
                    listItem.Type = "field";
                    createListInput.Columns.Add(listItem);
                    #endregion

                    #region << Queries >>
                    {
                        if (createListInput.Query == null)
                        {
                            createListInput.Query = new InputRecordListQuery();
                        }
                        createListInput.Query.FieldName = null;
                        createListInput.Query.FieldValue = null;
                        createListInput.Query.QueryType = "AND"; //AND,OR,EQ,NOT,LT,LTE,GT,GTE,CONTAINS,STARTSWITH
                        createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "name";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""name"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        createListInput.Query.SubQueries.Add(subQuery);
                    }
                    #endregion
                    {
                        var response = entMan.CreateRecordList(PROJECT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated List: lookup" + " Message:" + response.Message);
                    }
                }
                #endregion

            }
            #endregion

            #region << wv_milestone >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = MILESTONE_ENTITY_ID;
                    entity.Name = MILESTONE_ENTITY_NAME;
                    entity.Label = "Milestone";
                    entity.LabelPlural = "Milestones";
                    entity.System = true;
                    entity.IconName = "map-signs";
                    entity.Weight = 2;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("28c8351b-991d-420f-9a42-57201572571c");
                    systemItemIdDictionary["created_on"] = new Guid("7aa2003e-92d7-4073-ae59-6b9f02d87516");
                    systemItemIdDictionary["created_by"] = new Guid("b31ee492-b9ff-47b7-a79d-938935742e40");
                    systemItemIdDictionary["last_modified_on"] = new Guid("54c925f5-4f2a-4c55-883f-9ac450d807fe");
                    systemItemIdDictionary["last_modified_by"] = new Guid("f78a6530-7bc7-429d-9c38-27370fce19c0");
                    systemItemIdDictionary["user_wv_milestone_created_by"] = new Guid("7a6b7dca-ae20-4af5-a888-b3b6e2adf1aa");
                    systemItemIdDictionary["user_wv_milestone_modified_by"] = new Guid("1f0aa3d9-f50a-496c-bc86-b3e06a7ad8d9");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + MILESTONE_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << name >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("94cc3894-110a-4bb7-8c75-3e887cc83217");
                    textboxField.Name = "name";
                    textboxField.Label = "Name";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: name" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << start_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("9502a7e4-816c-433c-9f1e-6b1e2dffad62");
                    dateField.Name = "start_date";
                    dateField.Label = "Start date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = false;
                    dateField.Unique = false;
                    dateField.Searchable = false;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: start_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << end_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("1252a300-c871-4d79-8242-f036705cc86d");
                    dateField.Name = "end_date";
                    dateField.Label = "End date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = false;
                    dateField.Unique = false;
                    dateField.Searchable = false;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: end_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << status >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("63eed358-9b33-4d2c-b2cd-b533413df227");
                    dropdownField.Name = "status";
                    dropdownField.Label = "Status";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = false;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "opened";
                    dropdownField.Options = new List<SelectFieldOption>
                                {
                                    new SelectFieldOption(){ Key = "opened", Value = "opened" },
                                    new SelectFieldOption(){ Key = "completed", Value = "completed" }
                                };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: status" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("f1540e81-be80-4fed-b0c6-1d538b1dd17a");
                    guidField.Name = "project_id";
                    guidField.Label = "Project";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: project_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_tasks_not_started >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("aacfb1b6-8318-4c88-ad9d-7fa0ad799537");
                    numberField.Name = "x_tasks_not_started";
                    numberField.Label = "x_tasks_not_started";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: x_tasks_not_started" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_tasks_in_progress >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("07fb158a-2b3d-421f-a7f0-c296b5ce76c9");
                    numberField.Name = "x_tasks_in_progress";
                    numberField.Label = "x_tasks_in_progress";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: x_tasks_in_progress" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_tasks_completed >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("407db47b-23be-4ce1-ad97-e0c63d8e5377");
                    numberField.Name = "x_tasks_completed";
                    numberField.Label = "x_tasks_completed";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: x_tasks_completed" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_bugs_opened >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("014b2a7c-475d-4c0f-b992-0f6ddf3a5454");
                    numberField.Name = "x_bugs_opened";
                    numberField.Label = "x_bugs_opened";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: x_bugs_opened" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_bugs_reopened >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("3432d7eb-690a-4076-be24-e583fa1e83c3");
                    numberField.Name = "x_bugs_reopened";
                    numberField.Label = "x_bugs_reopened";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: x_bugs_reopened" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_bugs_closed >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("09bb35c9-ba7f-455f-8205-11a91fd7a90d");
                    numberField.Name = "x_bugs_closed";
                    numberField.Label = "x_bugs_closed";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(MILESTONE_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Field: x_bugs_closed" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_1_n_milestone Relation >>
                {
                    var originEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(MILESTONE_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("0c446f98-eec2-40c1-9d66-8a3c2a2498e9");
                    oneToNRelation.Name = "project_1_n_milestone";
                    oneToNRelation.Label = "project_1_n_milestone";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "project_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE project_1_n_milestone RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << create general list >>
                {
                    var createListEntity = entMan.ReadEntity(MILESTONE_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listItem = new InputRecordListFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();
                    //General list details
                    createListInput.Id = new Guid("92b40989-c3a2-4a06-869a-789fba54e733");
                    createListInput.Name = "project_milestones";
                    createListInput.Label = "Milestones";
                    createListInput.Default = true;
                    createListInput.System = true;
                    createListInput.Type = "general";
                    createListInput.IconName = "map-signs";
                    createListInput.PageSize = 10;
                    createListInput.Weight = 10;
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ServiceCode = null;
                    createListInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/project-milestones.html";
                    createListInput.DataSourceUrl = "/plugins/webvella-projects/api/project/milestones-list";

                    //Action items
                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline hidden-xs\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate')\" \n    ng-href=\"{{::ngCtrl.getRecordCreateUrl()}}\">Add New</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    createListInput.ActionItems = newActionItemList;
                    //Fields

                    {
                        var response = entMan.CreateRecordList(MILESTONE_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Updated List: general" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create create view >>
                {
                    var createViewEntity = entMan.ReadEntity(MILESTONE_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("95160359-aa0a-419f-92f4-4102fc692411");
                    createViewInput.Name = "create";
                    createViewInput.Label = "Create";
                    createViewInput.Title = "Create new milestone";
                    createViewInput.CssClass = "";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.Type = "create";
                    createViewInput.Weight = 10;
                    createViewInput.IconName = "file-text-o";
                    createViewInput.ServiceCode = null;
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    #endregion

                    #region << Get the header Region >>
                    var headerRegion = new InputRecordViewRegion();
                    headerRegion.Name = "header";
                    headerRegion.Label = "header";
                    headerRegion.Sections = new List<InputRecordViewSection>();
                    #endregion

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("dd96bfb9-0dbc-4a6b-b7c6-92fb54b1844a");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("7f59d113-b469-4579-b780-961ead238e46");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "start_date").Id;
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << project name >>
                    {
                        var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                        var targetRelation = relMan.Read("project_1_n_milestone").Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = targetRelation.Id;
                        viewItemFromRelation.RelationName = targetRelation.Name;
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << status >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "status").Id;
                        viewItem.FieldName = "status";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "end_date").Id;
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    headerRegion.Sections.Add(viewSection);

                    #endregion

                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    createViewInput.Regions.Add(headerRegion);

                    #region << Sidebar >>
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;
                    var sidebarItem = new InputRecordViewSidebarItemBase();

                    #endregion

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click='ngCtrl.create(\"details\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create & Details</a>";
                        actionItem.Weight = 2;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                        actionItem.Weight = 3;
                        newActionItemList.Add(actionItem);
                    }

                    createViewInput.ActionItems = newActionItemList;

                    {
                        var response = entMan.CreateRecordView(MILESTONE_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + MILESTONE_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion

            }
            #endregion

            #region << wv_task >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = TASK_ENTITY_ID;
                    entity.Name = TASK_ENTITY_NAME;
                    entity.Label = "Task";
                    entity.LabelPlural = "Tasks";
                    entity.System = true;
                    entity.IconName = "tasks";
                    entity.Weight = 4;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("916b8d1e-d6b6-45a9-9060-b0717b2b8b73");
                    systemItemIdDictionary["created_on"] = new Guid("6a83a91e-7eb8-4fb4-ab5f-5750cb4015d3");
                    systemItemIdDictionary["created_by"] = new Guid("b6ae3dc9-0c79-478c-89c9-3502f9da319f");
                    systemItemIdDictionary["last_modified_on"] = new Guid("55dcf9a2-79f7-42cc-8b3f-3cfea8f6dee3");
                    systemItemIdDictionary["last_modified_by"] = new Guid("39fc45d5-c472-44ed-b3f3-4687fb4a7501");
                    systemItemIdDictionary["user_wv_task_created_by"] = new Guid("0affc050-2c24-4ae3-bb5e-b08139661d83");
                    systemItemIdDictionary["user_wv_task_modified_by"] = new Guid("5d4730b0-82b7-401e-8eb3-1e4250aa82a1");

                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + TASK_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << number >>
                {
                    InputAutoNumberField autonumberField = new InputAutoNumberField();
                    autonumberField.Id = new Guid("1c7e71ce-125d-4afd-aa22-1c0a564bcb7b");
                    autonumberField.Name = "number";
                    autonumberField.Label = "Number";
                    autonumberField.PlaceholderText = "";
                    autonumberField.Description = "";
                    autonumberField.HelpText = "";
                    autonumberField.Required = true;
                    autonumberField.Unique = true;
                    autonumberField.Searchable = true;
                    autonumberField.Auditable = false;
                    autonumberField.System = true;
                    autonumberField.DefaultValue = 0;
                    autonumberField.DisplayFormat = "{0}";
                    autonumberField.StartingNumber = 1;
                    autonumberField.EnableSecurity = true;
                    autonumberField.Permissions = new FieldPermissions();
                    autonumberField.Permissions.CanRead = new List<Guid>();
                    autonumberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    autonumberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    autonumberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, autonumberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: number" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << code >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                    textboxField.Name = "code";
                    textboxField.Label = "Code";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = false;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: subject" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << subject >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                    textboxField.Name = "subject";
                    textboxField.Label = "Subject";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: subject" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << owner_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("d9cfe549-5ae2-45ee-b7ee-1a14a84b0166");
                    guidField.Name = "owner_id";
                    guidField.Label = "Owned by";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: owner_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << milestone_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("6bb67bc2-a09c-4785-b316-c8795696fc17");
                    guidField.Name = "milestone_id";
                    guidField.Label = "Release milestone";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: milestone_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << description >>
                {
                    InputHtmlField htmlField = new InputHtmlField();
                    htmlField.Id = new Guid("a00eb247-918a-46ba-9869-8d1168ea8f45");
                    htmlField.Name = "description";
                    htmlField.Label = "Description";
                    htmlField.PlaceholderText = "";
                    htmlField.Description = "";
                    htmlField.HelpText = "";
                    htmlField.Required = false;
                    htmlField.Unique = false;
                    htmlField.Searchable = false;
                    htmlField.Auditable = false;
                    htmlField.System = true;
                    htmlField.DefaultValue = string.Empty;
                    htmlField.EnableSecurity = true;
                    htmlField.Permissions = new FieldPermissions();
                    htmlField.Permissions.CanRead = new List<Guid>();
                    htmlField.Permissions.CanUpdate = new List<Guid>();

                    htmlField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanRead.Add(SystemIds.RegularRoleId);

                    htmlField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, htmlField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: description" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << parent_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("98f6cdf5-634c-494b-9e71-3aa7ee779328");
                    guidField.Name = "parent_id";
                    guidField.Label = "Parent task";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: parent_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("68e796c8-cc99-43b1-a285-2c6bc29f52f2");
                    guidField.Name = "project_id";
                    guidField.Label = "Project";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: project_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << start_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                    dateField.Name = "start_date";
                    dateField.Label = "Start date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = false;
                    dateField.Unique = false;
                    dateField.Searchable = true;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: start_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << end_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                    dateField.Name = "end_date";
                    dateField.Label = "End date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = false;
                    dateField.Unique = false;
                    dateField.Searchable = true;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: end_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << priority >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                    dropdownField.Name = "priority";
                    dropdownField.Label = "Priority";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = true;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "medium";
                    dropdownField.Options = new List<SelectFieldOption>
                                        {
                                            new SelectFieldOption(){ Key = "low", Value = "low" },
                                            new SelectFieldOption(){ Key = "medium", Value = "medium" },
                                            new SelectFieldOption(){ Key = "hight", Value = "hight" }
                                        };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: priority" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << status >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                    dropdownField.Name = "status";
                    dropdownField.Label = "Status";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = true;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "not started";
                    dropdownField.Options = new List<SelectFieldOption>
                                {
                                    new SelectFieldOption(){ Key = "not started", Value = "not started" },
                                    new SelectFieldOption(){ Key = "in progress", Value = "in progress" },
                                    new SelectFieldOption(){ Key = "completed", Value = "completed" }
                                };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: status" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_billable_hours >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("d79a25e4-3eeb-4a5b-84e8-294b0c146c4d");
                    numberField.Name = "x_billable_hours";
                    numberField.Label = "Billable hours";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = false;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: x_billable_hours" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_nonbillable_hours >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("a4196b7b-1de7-4106-b393-79eb3d1b4b79");
                    numberField.Name = "x_nonbillable_hours";
                    numberField.Label = "Non-Billable hours";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = false;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TASK_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Field: x_nonbillable_hours" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << user_1_n_task_owner Relation >>
                {
                    var originEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                    oneToNRelation.Name = "user_1_n_task_owner";
                    oneToNRelation.Label = "user_1_n_task_owner";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "owner_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE user_1_n_task_owner RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << user_n_n_task_watchers Relation >>
                {
                    var originEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    EntityRelation NToNRelation = new EntityRelation();
                    NToNRelation.Id = new Guid("de7e1578-8f8f-4454-a954-0fb62d3bf425");
                    NToNRelation.Name = "user_n_n_task_watchers";
                    NToNRelation.Label = "user_n_n_task_watchers";
                    NToNRelation.System = true;
                    NToNRelation.RelationType = EntityRelationType.ManyToMany;
                    NToNRelation.OriginEntityId = originEntity.Id;
                    NToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    NToNRelation.TargetEntityId = targetEntity.Id;
                    NToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "id").Id;
                    {
                        var result = relMan.Create(NToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE user_n_n_task_watchers RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << task_1_n_task_parent Relation >>
                {
                    var originEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("fd42ca83-9c08-4e7d-ba97-782208f44b18");
                    oneToNRelation.Name = "task_1_n_task_parent";
                    oneToNRelation.Label = "task_1_n_task_parent";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "parent_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE task_1_n_task_parent RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << project_1_n_task Relation >>
                {
                    var originEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817");
                    oneToNRelation.Name = "project_1_n_task";
                    oneToNRelation.Label = "project_1_n_task";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "project_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE project_1_n_task RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << milestone_1_n_task Relation >>
                {
                    var originEntity = entMan.ReadEntity(MILESTONE_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("3b600a1c-066e-42e2-a678-0de4f0f8a9e1");
                    oneToNRelation.Name = "milestone_1_n_task";
                    oneToNRelation.Label = "milestone_1_n_task";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "milestone_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE milestone_1_n_task RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << create general list >>
                {
                    var createListEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    //General list details
                    createListInput.Id = new Guid("44f8ed83-b7e8-4223-b02e-b5e35ed4bcc1");
                    createListInput.Name = "project_tasks";
                    createListInput.Label = "Project Tasks";
                    createListInput.Default = true;
                    createListInput.System = true;
                    createListInput.IconName = "tasks";
                    createListInput.Type = "hidden";
                    createListInput.PageSize = 10;
                    createListInput.Weight = 10;
                    createListInput.ColumnWidthsCSV = "auto,30px,120px,120px,120px,120px";
                    createListInput.CssClass = "task-list";
                    createListInput.VisibleColumnsCount = 6;
                    createListInput.ServiceCode = null;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    //Fields
                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listFieldFromRelation.RelationName = "user_1_n_task_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "start_date").Id;
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "end_date").Id;
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << query main>>
                    {
                        listQuery = new InputRecordListQuery();
                        listQuery.FieldName = null;
                        listQuery.FieldValue = null;
                        listQuery.QueryType = "AND";
                        listQuery.SubQueries = new List<InputRecordListQuery>();

                        #region << subject >>
                        {
                            var subQuery = new InputRecordListQuery();
                            subQuery.FieldName = "subject";
                            subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                            subQuery.QueryType = "CONTAINS";
                            subQuery.SubQueries = new List<InputRecordListQuery>();
                            listQuery.SubQueries.Add(subQuery);
                        }
                        #endregion

                        #region << status >>
                        {
                            var subQuery = new InputRecordListQuery();
                            subQuery.FieldName = "status";
                            subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                            subQuery.QueryType = "EQ";
                            subQuery.SubQueries = new List<InputRecordListQuery>();
                            listQuery.SubQueries.Add(subQuery);
                        }
                        #endregion

                        #region << priority >>
                        {
                            var subQuery = new InputRecordListQuery();
                            subQuery.FieldName = "priority";
                            subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                            subQuery.QueryType = "EQ";
                            subQuery.SubQueries = new List<InputRecordListQuery>();
                            listQuery.SubQueries.Add(subQuery);
                        }
                        #endregion

                        createListInput.Query = listQuery;
                    }
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    {
                        listSort = new InputRecordListSort();
                        listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""end_date"", ""settings"":{""order"":""sortOrder""}}";
                        listSort.SortType = "ascending";
                        createListInput.Sorts.Add(listSort);
                    }
                    #endregion

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline hidden-xs\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate')\" \n    ng-href=\"{{::ngCtrl.getRecordCreateUrl()}}\">Add New</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Template = "<a ng-click=\"ngCtrl.openImportModal()\" class=\"ng-hide\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')\">\n\t<i class=\"fa fa-fw fa-upload\"></i> Import CSV\n</a>";
                        actionItem.Weight = 10;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Template = "<a ng-click=\"ngCtrl.openExportModal()\" class=\"ng-hide\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')\">\n\t<i class=\"fa fa-fw fa-download\"></i> Export CSV\n</a>";
                        actionItem.Weight = 11;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-href=\"{{::ngCtrl.getRecordDetailsUrl(record)}}\">\n    <i class=\"fa fa-fw fa-eye\"></i>\n</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    createListInput.ActionItems = newActionItemList;
                    {
                        var response = entMan.CreateRecordList(TASK_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated List: general" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: my_tasks >>
                {
                    var createListEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("42da1595-bf3f-49b1-a784-1218b07d668d");
                    createListInput.Type = "general";
                    createListInput.Name = "my_tasks";
                    createListInput.Label = "My Owned Active Tasks";
                    createListInput.Weight = 1;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "task-list";
                    createListInput.IconName = "tasks";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listFieldFromRelation.RelationName = "user_1_n_task_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "start_date").Id;
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "end_date").Id;
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << Section 1 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << owner_id >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "owner_id";
                        subQuery.FieldValue = @"{""name"":""current_user"", ""option"": ""id"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #region << Section 2 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = "completed";
                        subQuery.QueryType = "NOT";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""end_date"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "descending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(TASK_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated List: my_tickets" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: created_tasks >>
                {
                    var createListEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("dcdc058e-2684-4b80-b011-25ccc3dab184");
                    createListInput.Type = "general";
                    createListInput.Name = "created_tasks";
                    createListInput.Label = "Tasks created by me";
                    createListInput.Weight = 3;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "task-list";
                    createListInput.IconName = "tasks";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listFieldFromRelation.RelationName = "user_1_n_task_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "start_date").Id;
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "end_date").Id;
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << Section 1 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << created_by >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "created_by";
                        subQuery.FieldValue = @"{""name"":""current_user"", ""option"": ""id"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #region << Section 2 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""end_date"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "descending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(TASK_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated List: my_tickets" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: owned_tasks >>
                {
                    var createListEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("930b8c52-1cda-4419-9cf4-7a41af95d776");
                    createListInput.Type = "general";
                    createListInput.Name = "owned_tasks";
                    createListInput.Label = "Tasks owned by me";
                    createListInput.Weight = 2;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "task-list";
                    createListInput.IconName = "tasks";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listFieldFromRelation.RelationName = "user_1_n_task_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "start_date").Id;
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "end_date").Id;
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << Section 1 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "OR";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << owner_id >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "owner_id";
                        subQuery.FieldValue = @"{""name"":""current_user"", ""option"": ""id"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #region << Section 2 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << number >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""number"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""end_date"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "descending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(TASK_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated List: my_tickets" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: all_tasks >>
                {
                    var createListEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("6b6ac308-bb21-46a3-b83c-0559348b2f46");
                    createListInput.Type = "general";
                    createListInput.Name = "all_tasks";
                    createListInput.Label = "All Tasks";
                    createListInput.Weight = 12;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "task-list";
                    createListInput.IconName = "tasks";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = @"/plugins/webvella-projects/api/task/list/all";
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                        @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                                            <i class=""fa fa-fw fa-eye""></i>
                                            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listFieldFromRelation.RelationName = "user_1_n_task_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "start_date").Id;
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "end_date").Id;
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        createListInput.Query.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        createListInput.Query.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        createListInput.Query.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        createListInput.Query.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""end_date"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "descending";
                    createListInput.Sorts.Add(listSort);
                    #endregion

                    {
                        var response = entMan.CreateRecordList(TASK_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated List: all_tickets" + " Message:" + response.Message);
                    }

                }
                #endregion

                #region << List name: admin >>
                {
                    var createListEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("10dce98d-843f-48ca-94be-da33a910375e");
                    createListInput.Type = "hidden";
                    createListInput.Name = "admin";
                    createListInput.Label = "All tasks";
                    createListInput.Weight = 2;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "task-list";
                    createListInput.IconName = "tasks";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "80px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listFieldFromRelation.RelationName = "user_1_n_task_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "start_date").Id;
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "end_date").Id;
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "owner_id";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query = listQuery;
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""end_date"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "descending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(TASK_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated List: admin" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create create >>
                {
                    var createViewEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("b879c8f8-1738-4f33-94aa-89064f227ed9");
                    createViewInput.Name = "create";
                    createViewInput.Label = "Create";
                    createViewInput.Title = "";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.Type = "create";
                    createViewInput.Weight = 10;
                    createViewInput.IconName = "file-text-o";
                    createViewInput.ServiceCode = null;
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    #endregion

                    #region << Get the header Region >>
                    var headerRegion = new InputRecordViewRegion();
                    headerRegion.Name = "header";
                    headerRegion.Label = "header";
                    headerRegion.Sections = new List<InputRecordViewSection>();
                    #endregion

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("8b628f5d-16b3-49d0-a433-a910ea208b39");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("818f516c-f6c2-4073-8574-75c13a72aee4");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << subject >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "subject").Id;
                        viewItem.FieldName = "subject";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << project name >>
                    {
                        var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817");
                        viewItemFromRelation.RelationName = "project_1_n_task";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << description >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    #region << Row 2 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("2144c60b-4974-44e2-86ef-5ceec72d04f8");
                    viewRow.Weight = 2;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << status >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "status").Id;
                        viewItem.FieldName = "status";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "start_date").Id;
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column 2 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << priority >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "priority").Id;
                        viewItem.FieldName = "priority";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "end_date").Id;
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    headerRegion.Sections.Add(viewSection);

                    #endregion
                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    createViewInput.Regions.Add(headerRegion);

                    #region << Sidebar >>
                    var sidebarItem = new InputRecordViewSidebarItemBase();
                    #endregion`

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click='ngCtrl.create(\"details\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create & Details</a>";
                        actionItem.Weight = 2;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                        actionItem.Weight = 3;
                        newActionItemList.Add(actionItem);
                    }
                    createViewInput.ActionItems = newActionItemList;

                    {
                        var response = entMan.CreateRecordView(TASK_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << View name: project_milestone >>
                {
                    var createViewEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewRegion = new InputRecordViewRegion();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();

                    #region << details >>
                    createViewInput.Id = new Guid("820b6771-3100-4393-982b-3813d79f4df2");
                    createViewInput.Type = "hidden";
                    createViewInput.Name = "project_milestone";
                    createViewInput.Label = "Project & Milestone";
                    createViewInput.Title = "";
                    createViewInput.Default = false;
                    createViewInput.System = true;
                    createViewInput.Weight = 10;
                    createViewInput.CssClass = null;
                    createViewInput.IconName = "code";
                    createViewInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/task-project-milestone-selection.html";
                    createViewInput.DataSourceUrl = null;
                    createViewInput.ServiceCode = null;
                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    #endregion

                    #region << Header Region >>
                    viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = 1;
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("e886ea83-cb6f-408e-9fa9-a53cd249b714");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row Column>>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("20be17ac-e915-4ac3-87a3-ab1ef534975f");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << milestone_1_n_task>name from Relation >>
                    {
                        var targetEntity = entMan.ReadEntity(MILESTONE_ENTITY_ID).Object;
                        var targetRelation = relMan.Read("milestone_1_n_task").Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Milestone";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = targetRelation.Id;
                        viewItemFromRelation.RelationName = targetRelation.Name;
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region <<  project_1_n_task>name from Relation >>
                    {
                        var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                        var targetRelation = relMan.Read("project_1_n_task").Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Milestone";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = targetRelation.Id;
                        viewItemFromRelation.RelationName = targetRelation.Name;
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    viewRegion.Sections.Add(viewSection);
                    #endregion

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                    #endregion

                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    createViewInput.ActionItems = new List<ActionItem>();
                    #region << Sidebar >>
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    {
                        var response = entMan.CreateRecordView(createViewEntity.Id, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + createViewEntity.Name + " Updated view: project_milestone" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create general >>
                {
                    var createViewEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    var viewItemView = new InputRecordViewViewItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("f3d3a025-ffd5-4eba-86d3-42bde882f597");
                    createViewInput.Name = "general";
                    createViewInput.Label = "[{code}] {subject}";
                    createViewInput.Title = "";
                    createViewInput.Type = "general";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.IconName = "tasks";
                    createViewInput.ServiceCode = "";
                    #endregion

                    #region << Get the header Region >>
                    var headerRegion = new InputRecordViewRegion();
                    headerRegion.Name = "header";
                    headerRegion.Label = "header";
                    headerRegion.Sections = new List<InputRecordViewSection>();
                    #endregion

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("0289b876-b6be-4d5f-915b-22dc0428bc25");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("cbf260ae-07e3-4e66-be57-beb7a36779bf");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 8;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << subject >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "subject").Id;
                        viewItem.FieldName = "subject";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << project_milestone name >>
                    {
                        var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                        viewItemView = new InputRecordViewViewItem();
                        viewItemView.EntityId = targetEntity.Id;
                        viewItemView.EntityName = targetEntity.Name;
                        viewItemView.Type = "view";
                        viewItemView.ViewId = targetEntity.RecordViews.Single(x => x.Name == "project_milestone").Id;
                        viewColumn.Items.Add(viewItemView);
                    }
                    #endregion

                    #region << description >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column 2 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 4;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << code >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "code").Id;
                        viewItem.FieldName = "code";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << status >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "status").Id;
                        viewItem.FieldName = "status";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << priority >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "priority").Id;
                        viewItem.FieldName = "priority";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << owner >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                        viewItemFromRelation.FieldName = "username";
                        viewItemFromRelation.FieldLabel = "Owner";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        viewItemFromRelation.RelationName = "user_1_n_task_owner";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << start_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "start_date").Id;
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << end_date >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "end_date").Id;
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << watchers >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var targetRelation = relMan.Read("user_n_n_task_watchers").Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                        viewItemFromRelation.FieldName = "username";
                        viewItemFromRelation.FieldLabel = "Watchers";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = targetRelation.Id;
                        viewItemFromRelation.RelationName = targetRelation.Name;
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    headerRegion.Sections.Add(viewSection);

                    #endregion

                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    createViewInput.Regions.Add(headerRegion);

                    #region << Sidebar >>
                    var sidebarItem = new InputRecordViewSidebarItemBase();
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    #region << Action items edit >>
                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Template = "<a href=\"javascript:void(0)\" confirmed-click=\"::ngCtrl.deleteRecord(ngCtrl)\" ng-confirm-click=\"Are you sure?\"\n\t\tng-if=\"::ngCtrl.userHasRecordPermissions('canDelete')\">\n\t<i class=\"fa fa-trash go-red\"></i> Delete Record\n</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    createViewInput.ActionItems = newActionItemList;
                    #endregion

                    {
                        var response = entMan.CreateRecordView(TASK_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << area add subscription: Project Workplace -> My tasks >>
                {
                    var updatedAreaId = PROJECT_WORKPLACE_AREA_ID;
                    var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, TASK_ENTITY_NAME, "general", "create", "my_tasks");
                    if (!updateAreaResult.Success)
                    {
                        throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                    }
                }
                #endregion

                #region << area add subscription: Project Admin -> Bugs >>
                {
                    var updatedAreaId = PROJECT_ADMIN_AREA_ID;
                    var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, TASK_ENTITY_NAME, "general", "create", "admin");
                    if (!updateAreaResult.Success)
                    {
                        throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                    }
                }
                #endregion
            }
            #endregion

            #region << wv_bug >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = BUG_ENTITY_ID;
                    entity.Name = BUG_ENTITY_NAME;
                    entity.Label = "Bug";
                    entity.LabelPlural = "Bugs";
                    entity.System = true;
                    entity.IconName = "bug";
                    entity.Weight = 5;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("85e92948-ca90-4983-854d-c1fbad0d7e8c");
                    systemItemIdDictionary["created_on"] = new Guid("781cee71-1632-4bf9-83b1-ff122d29eb2a");
                    systemItemIdDictionary["created_by"] = new Guid("72b3a792-7ee8-420c-a48e-86c5beda474b");
                    systemItemIdDictionary["last_modified_on"] = new Guid("ce3c4668-be18-4217-898e-704d126dc8a2");
                    systemItemIdDictionary["last_modified_by"] = new Guid("18fdd103-06ee-449b-9140-098ea171670a");
                    systemItemIdDictionary["user_wv_bug_created_by"] = new Guid("cdc5c5f9-30dc-4e3b-ac0f-4137e54c6c7f");
                    systemItemIdDictionary["user_wv_bug_modified_by"] = new Guid("a09464e2-0383-435a-a1e7-52c6d2a2743c");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + BUG_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << number >>
                {
                    InputAutoNumberField autonumberField = new InputAutoNumberField();
                    autonumberField.Id = new Guid("01a14364-7e42-42ed-b6aa-92525b7b36fb");
                    autonumberField.Name = "number";
                    autonumberField.Label = "Number";
                    autonumberField.PlaceholderText = "";
                    autonumberField.Description = "";
                    autonumberField.HelpText = "";
                    autonumberField.Required = true;
                    autonumberField.Unique = true;
                    autonumberField.Searchable = true;
                    autonumberField.Auditable = false;
                    autonumberField.System = true;
                    autonumberField.DefaultValue = 0;
                    autonumberField.DisplayFormat = "{0}";
                    autonumberField.StartingNumber = 1;
                    autonumberField.EnableSecurity = true;
                    autonumberField.Permissions = new FieldPermissions();
                    autonumberField.Permissions.CanRead = new List<Guid>();
                    autonumberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    autonumberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    autonumberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, autonumberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: number" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << code >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
                    textboxField.Name = "code";
                    textboxField.Label = "Code";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = false;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: code" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << subject >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                    textboxField.Name = "subject";
                    textboxField.Label = "Subject";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = true;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: subject" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << description >>
                {
                    InputHtmlField htmlField = new InputHtmlField();
                    htmlField.Id = new Guid("4afe9621-39ee-40b9-a3ef-cb9b98131a6a");
                    htmlField.Name = "description";
                    htmlField.Label = "Description";
                    htmlField.PlaceholderText = "";
                    htmlField.Description = "";
                    htmlField.HelpText = "";
                    htmlField.Required = false;
                    htmlField.Unique = false;
                    htmlField.Searchable = false;
                    htmlField.Auditable = false;
                    htmlField.System = true;
                    htmlField.DefaultValue = string.Empty;
                    htmlField.EnableSecurity = true;
                    htmlField.Permissions = new FieldPermissions();
                    htmlField.Permissions.CanRead = new List<Guid>();
                    htmlField.Permissions.CanUpdate = new List<Guid>();

                    htmlField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanRead.Add(SystemIds.RegularRoleId);

                    htmlField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, htmlField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: description" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << priority >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                    dropdownField.Name = "priority";
                    dropdownField.Label = "Priority";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = true;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "medium";
                    dropdownField.Options = new List<SelectFieldOption>
                                {
                                    new SelectFieldOption(){ Key = "low", Value = "low" },
                                    new SelectFieldOption(){ Key = "medium", Value = "medium" },
                                    new SelectFieldOption(){ Key = "hight", Value = "hight" }
                                };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: priority" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << owner_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("0ed595db-1abd-4a74-b160-db879c33cba9");
                    guidField.Name = "owner_id";
                    guidField.Label = "Owned by";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: owner_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("dd345ce0-476f-4e74-a0b7-5f5c8ee480d6");
                    guidField.Name = "project_id";
                    guidField.Label = "Project";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: project_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << milestone_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("bd817922-e269-44cf-bc84-64911b5abbdd");
                    guidField.Name = "milestone_id";
                    guidField.Label = "Release milestone";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: milestone_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << status >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                    dropdownField.Name = "status";
                    dropdownField.Label = "Status";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = true;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = true;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "opened";
                    dropdownField.Options = new List<SelectFieldOption>
                                {
                                    new SelectFieldOption(){ Key = "opened", Value = "opened" },
                                    new SelectFieldOption(){ Key = "closed", Value = "closed" },
                                    new SelectFieldOption(){ Key = "reopened", Value = "reopened" }
                                };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: status" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_billable_hours >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("20fa3394-39f8-4ad0-8743-3f75afed8f8f");
                    numberField.Name = "x_billable_hours";
                    numberField.Label = "Billable hours";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = false;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: x_billable_hours" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << x_nonbillable_hours >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("08c8cea9-79e1-4908-8611-abfa4c087209");
                    numberField.Name = "x_nonbillable_hours";
                    numberField.Label = "Non-Billable hours";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = false;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = null;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 0;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(BUG_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Field: x_nonbillable_hours" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << user_1_n_bug_owner Relation >>
                {
                    var originEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                    oneToNRelation.Name = "user_1_n_bug_owner";
                    oneToNRelation.Label = "user_1_n_bug_owner";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "owner_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE user_1_n_bug_owner RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << user_n_n_bug_watchers Relation >>
                {
                    var originEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    EntityRelation NToNRelation = new EntityRelation();
                    NToNRelation.Id = new Guid("b71d0c52-1626-48da-91bc-e10999ba79b8");
                    NToNRelation.Name = "user_n_n_bug_watchers";
                    NToNRelation.Label = "user_n_n_bug_watchers";
                    NToNRelation.System = true;
                    NToNRelation.RelationType = EntityRelationType.ManyToMany;
                    NToNRelation.OriginEntityId = originEntity.Id;
                    NToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    NToNRelation.TargetEntityId = targetEntity.Id;
                    NToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "id").Id;
                    {
                        var result = relMan.Create(NToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE user_n_n_bug_watchers RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << task_n_n_bug Relation >>
                {
                    var originEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    EntityRelation NToNRelation = new EntityRelation();
                    NToNRelation.Id = new Guid("7103355b-bf03-40e1-8446-f6aeecfaa74c");
                    NToNRelation.Name = "task_n_n_bug";
                    NToNRelation.Label = "task_n_n_bug";
                    NToNRelation.System = true;
                    NToNRelation.RelationType = EntityRelationType.ManyToMany;
                    NToNRelation.OriginEntityId = originEntity.Id;
                    NToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    NToNRelation.TargetEntityId = targetEntity.Id;
                    NToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "id").Id;
                    {
                        var result = relMan.Create(NToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE task_n_n_bug RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << project_1_n_bug Relation >>
                {
                    var originEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("d94f100c-024c-47e7-af32-d67a49be2b6c");
                    oneToNRelation.Name = "project_1_n_bug";
                    oneToNRelation.Label = "project_1_n_bug";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "project_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE project_1_n_bug RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << create project_bugs list >>
                {
                    var createListEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    //General list details
                    createListInput.Id = new Guid("3b2ebe34-1d02-448a-9616-5b62538fe2c7");
                    createListInput.Name = "project_bugs";
                    createListInput.Label = "Bugs";
                    createListInput.Weight = 10;
                    createListInput.Default = true;
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.IconName = "bug";
                    createListInput.ColumnWidthsCSV = "auto,30px,120px,120px,120px";
                    createListInput.CssClass = "bug-list";
                    createListInput.Type = "hidden";

                    //Fields
                    createListInput.Columns = new List<InputRecordListItemBase>();
                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listFieldFromRelation.RelationName = "user_1_n_bug_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_on >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "created_on").Id;
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << query main>>
                    {
                        listQuery = new InputRecordListQuery();
                        listQuery.FieldName = null;
                        listQuery.FieldValue = null;
                        listQuery.QueryType = "AND";
                        listQuery.SubQueries = new List<InputRecordListQuery>();

                        #region << subject >>
                        {
                            var subQuery = new InputRecordListQuery();
                            subQuery.FieldName = "subject";
                            subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                            subQuery.QueryType = "CONTAINS";
                            subQuery.SubQueries = new List<InputRecordListQuery>();
                            listQuery.SubQueries.Add(subQuery);
                        }
                        #endregion
                        #region << subject >>
                        {
                            var subQuery = new InputRecordListQuery();
                            subQuery.FieldName = "status";
                            subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                            subQuery.QueryType = "EQ";
                            subQuery.SubQueries = new List<InputRecordListQuery>();
                            listQuery.SubQueries.Add(subQuery);
                        }
                        #endregion
                        #region << priority >>
                        {
                            var subQuery = new InputRecordListQuery();
                            subQuery.FieldName = "priority";
                            subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                            subQuery.QueryType = "EQ";
                            subQuery.SubQueries = new List<InputRecordListQuery>();
                            listQuery.SubQueries.Add(subQuery);
                        }
                        #endregion

                        createListInput.Query = listQuery;
                    }
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    {
                        listSort = new InputRecordListSort();
                        listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""created_on"", ""settings"":{""order"":""sortOrder""}}";
                        listSort.SortType = "descending";
                        createListInput.Sorts.Add(listSort);
                    }
                    #endregion

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline hidden-xs\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate')\" \n    ng-href=\"{{::ngCtrl.getRecordCreateUrl()}}\">Add New</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Template = "<a ng-click=\"ngCtrl.openImportModal()\" class=\"ng-hide\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')\">\n\t<i class=\"fa fa-fw fa-upload\"></i> Import CSV\n</a>";
                        actionItem.Weight = 10;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Template = "<a ng-click=\"ngCtrl.openExportModal()\" class=\"ng-hide\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')\">\n\t<i class=\"fa fa-fw fa-download\"></i> Export CSV\n</a>";
                        actionItem.Weight = 11;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-href=\"{{::ngCtrl.getRecordDetailsUrl(record)}}\">\n    <i class=\"fa fa-fw fa-eye\"></i>\n</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    createListInput.ActionItems = newActionItemList;

                    {
                        var response = entMan.CreateRecordList(BUG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated List: general" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: my_bugs >>
                {
                    var createListEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("2ac91f01-0ee5-420e-8981-4f57eaea255e");
                    createListInput.Type = "general";
                    createListInput.Name = "my_bugs";
                    createListInput.Label = "My Owned Open Bugs";
                    createListInput.Weight = 1;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "bug-list";
                    createListInput.IconName = "bug";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,160px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var targetRelation = relMan.Read("user_1_n_bug_owner").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = targetRelation.Id;
                        listFieldFromRelation.RelationName = targetRelation.Name;
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_on >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "created_on").Id;
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << Section 1 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << owner_id >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "owner_id";
                        subQuery.FieldValue = @"{""name"":""current_user"", ""option"": ""id"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #region << Section 2 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = "closed";
                        subQuery.QueryType = "NOT";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""created_on"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(BUG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated List: my_tickets" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: created_bugs >>
                {
                    var createListEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("42356233-9a6b-4fcb-ae2b-42ca29d84fe8");
                    createListInput.Type = "general";
                    createListInput.Name = "created_bugs";
                    createListInput.Label = "Bugs created by me";
                    createListInput.Weight = 3;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "bug-list";
                    createListInput.IconName = "bug";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var targetRelation = relMan.Read("user_1_n_bug_owner").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = targetRelation.Id;
                        listFieldFromRelation.RelationName = targetRelation.Name;
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << Section 1 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << created_by >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "created_by";
                        subQuery.FieldValue = @"{""name"":""current_user"", ""option"": ""id"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #region << Section 2 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""created_on"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(BUG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated List: bug_created" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: owned_bugs >>
                {
                    var createListEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("c3f5b3f5-9d15-4b5a-a2cc-70e0d85efaf7");
                    createListInput.Type = "general";
                    createListInput.Name = "owned_bugs";
                    createListInput.Label = "Bugs owned by me";
                    createListInput.Weight = 2;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "bug-list";
                    createListInput.IconName = "bug";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var targetRelation = relMan.Read("user_1_n_bug_owner").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = targetRelation.Id;
                        listFieldFromRelation.RelationName = targetRelation.Name;
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << query >>
                    createListInput.Query = new InputRecordListQuery();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();

                    #region << Section 1 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "OR";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << owner_id >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "owner_id";
                        subQuery.FieldValue = @"{""name"":""current_user"", ""option"": ""id"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #region << Section 2 >>
                    listQuery = new InputRecordListQuery();
                    listQuery.FieldName = null;
                    listQuery.FieldValue = null;
                    listQuery.QueryType = "AND";
                    listQuery.SubQueries = new List<InputRecordListQuery>();

                    #region << code >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "code";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""code"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "subject";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""subject"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "CONTAINS";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << status >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "status";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""status"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    #region << priority >>
                    {
                        var subQuery = new InputRecordListQuery();
                        subQuery.FieldName = "priority";
                        subQuery.FieldValue = @"{""name"":""url_query"", ""option"": ""priority"", ""default"": null, ""settings"":{}}";
                        subQuery.QueryType = "EQ";
                        subQuery.SubQueries = new List<InputRecordListQuery>();
                        listQuery.SubQueries.Add(subQuery);
                    }
                    #endregion

                    createListInput.Query.SubQueries.Add(listQuery);
                    #endregion

                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""created_on"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(BUG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated List: owned_bug" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: all_bugs >>
                {
                    var createListEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("97658e2a-69fb-48f5-b84c-236e1bd0103b");
                    createListInput.Type = "general";
                    createListInput.Name = "all_bugs";
                    createListInput.Label = "All Bugs";
                    createListInput.Weight = 12;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "bug-list";
                    createListInput.IconName = "bug";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = @"/plugins/webvella-projects/api/bug/list/all";
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                        @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                                            <i class=""fa fa-fw fa-eye""></i>
                                            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "code").Id;
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var targetRelation = relMan.Read("user_1_n_bug_owner").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = targetRelation.Id;
                        listFieldFromRelation.RelationName = targetRelation.Name;
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << query >>
                    createListInput.Query = null;
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    #endregion

                    {
                        var response = entMan.CreateRecordList(BUG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated List: all_bugs" + " Message:" + response.Message);
                    }

                }
                #endregion

                #region << List name: admin >>
                {
                    var createListEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("dd4eb5d6-0ada-4151-90af-675e2cc831e5");
                    createListInput.Type = "hidden";
                    createListInput.Name = "admin";
                    createListInput.Label = "All Bugs";
                    createListInput.Weight = 3;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = "bug-list";
                    createListInput.IconName = "bug";
                    createListInput.VisibleColumnsCount = 7;
                    createListInput.ColumnWidthsCSV = "auto,30px,120px,120px,120px,120px";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << subject >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "subject").Id;
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << owner - image >>
                    {
                        var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = targetEntity.Id;
                        listFieldFromRelation.EntityName = targetEntity.Name;
                        listFieldFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.FieldLabel = "Owner";
                        listFieldFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listFieldFromRelation.RelationName = "user_1_n_bug_owner";
                        listFieldFromRelation.Type = "fieldFromRelation";
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_on >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "created_on").Id;
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << status >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "status").Id;
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << priority >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "priority").Id;
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = @"{""name"":""url_sort"", ""option"": ""sortBy"", ""default"": ""created_on"", ""settings"":{""order"":""sortOrder""}}";
                    listSort.SortType = "descending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(BUG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated List: my_tickets" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create create >>
                {
                    var createViewEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("b369195d-39b2-4b69-abd3-5182477c7783");
                    createViewInput.Name = "create";
                    createViewInput.Label = "Create";
                    createViewInput.Title = "";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.Type = "create";
                    createViewInput.Weight = 10;
                    createViewInput.IconName = "file-text-o";
                    createViewInput.ServiceCode = null;
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    #endregion

                    #region << Get the header Region >>
                    var headerRegion = new InputRecordViewRegion();
                    headerRegion.Name = "header";
                    headerRegion.Label = "header";
                    headerRegion.Sections = new List<InputRecordViewSection>();
                    #endregion

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("6781b136-b982-4934-a98c-5f736bd1a771");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("c0e3757b-6817-4eda-8cd1-e95b603af049");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << subject >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "subject").Id;
                        viewItem.FieldName = "subject";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << project name >>
                    {
                        var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                        var targetRelation = relMan.Read("project_1_n_bug").Object;
                        viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = targetEntity.Id;
                        viewItemFromRelation.EntityName = targetEntity.Name;
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = targetRelation.Id;
                        viewItemFromRelation.RelationName = targetRelation.Name;
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion

                    #region << description >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    #region << Row 2 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("61b3052c-339d-4ad2-8a5f-59f215f07358");
                    viewRow.Weight = 2;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << status >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "status").Id;
                        viewItem.FieldName = "status";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column 2 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << priority >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "priority").Id;
                        viewItem.FieldName = "priority";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    headerRegion.Sections.Add(viewSection);

                    #endregion

                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    createViewInput.Regions.Add(headerRegion);

                    #region << Sidebar >>
                    var sidebarItem = new InputRecordViewSidebarItemBase();
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click='ngCtrl.create(\"details\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create & Details</a>";
                        actionItem.Weight = 2;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                        actionItem.Weight = 3;
                        newActionItemList.Add(actionItem);
                    }
                    createViewInput.ActionItems = newActionItemList;

                    {
                        var response = entMan.CreateRecordView(BUG_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create general >>
                {
                    var createViewEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("cc8ca474-29d3-4593-864a-166ad9e9a98e");
                    createViewInput.Name = "general";
                    createViewInput.Label = "General";
                    createViewInput.Title = "";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.Type = "general";
                    createViewInput.Weight = 10;
                    createViewInput.IconName = "file-text-o";
                    createViewInput.ServiceCode = null;
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    #endregion

                    createViewInput.Regions = new List<InputRecordViewRegion>();

                    #region << Sidebar >>
                    var sidebarItem = new InputRecordViewSidebarItemBase();
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click='ngCtrl.create(\"details\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create & Details</a>";
                        actionItem.Weight = 2;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                        actionItem.Weight = 3;
                        newActionItemList.Add(actionItem);
                    }
                    createViewInput.ActionItems = newActionItemList;

                    {
                        var response = entMan.CreateRecordView(BUG_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << area add subscription: Project Admin -> Bugs >>
                {
                    var updatedAreaId = PROJECT_ADMIN_AREA_ID;
                    var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, BUG_ENTITY_NAME, "general", "create", "admin");
                    if (!updateAreaResult.Success)
                    {
                        throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                    }
                }
                #endregion

                #region << area add subscription: Project Workplace -> My bugs >>
                {
                    var updatedAreaId = PROJECT_WORKPLACE_AREA_ID;
                    var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, BUG_ENTITY_NAME, "general", "create", "my_bugs");
                    if (!updateAreaResult.Success)
                    {
                        throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                    }
                }
                #endregion
            }
            #endregion

            #region << wv_timelog >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = TIMELOG_ENTITY_ID;
                    entity.Name = TIMELOG_ENTITY_NAME;
                    entity.Label = "Time log";
                    entity.LabelPlural = "Time logs";
                    entity.System = true;
                    entity.IconName = "clock-o";
                    entity.Weight = 9;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("41a9a85b-894d-40d1-956a-dba950a253c7");
                    systemItemIdDictionary["created_on"] = new Guid("ca1e843f-7f97-49db-bb7f-4b3a2b8f98ef");
                    systemItemIdDictionary["created_by"] = new Guid("1cc75ad8-dd5b-4cdb-8896-32521e0a7a2e");
                    systemItemIdDictionary["last_modified_on"] = new Guid("e91995d3-754e-418f-9a2d-aa2a319c568b");
                    systemItemIdDictionary["last_modified_by"] = new Guid("19b6101a-737e-4dec-96fe-3994b3fb8b65");
                    systemItemIdDictionary["user_wv_timelog_created_by"] = new Guid("393d1da8-0051-4807-8e89-1de933850888");
                    systemItemIdDictionary["user_wv_timelog_modified_by"] = new Guid("2c728372-8dc4-4d18-8897-4716fce3d404");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + TIMELOG_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << billable >>
                {
                    InputCheckboxField checkboxField = new InputCheckboxField();
                    checkboxField.Id = new Guid("1f4b0729-4e31-4722-a8ce-3bf90c471dad");
                    checkboxField.Name = "billable";
                    checkboxField.Label = "Billable";
                    checkboxField.PlaceholderText = "";
                    checkboxField.Description = "";
                    checkboxField.HelpText = "";
                    checkboxField.Required = true;
                    checkboxField.Unique = false;
                    checkboxField.Searchable = false;
                    checkboxField.Auditable = false;
                    checkboxField.System = true;
                    checkboxField.DefaultValue = true;
                    checkboxField.EnableSecurity = true;
                    checkboxField.Permissions = new FieldPermissions();
                    checkboxField.Permissions.CanRead = new List<Guid>();
                    checkboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    checkboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    checkboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    checkboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    checkboxField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TIMELOG_ENTITY_ID, checkboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Field: field_name" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << hours >>
                {
                    InputNumberField numberField = new InputNumberField();
                    numberField.Id = new Guid("41caeb03-7430-4eb8-b830-c9df8bf2dc7f");
                    numberField.Name = "hours";
                    numberField.Label = "Hours";
                    numberField.PlaceholderText = "";
                    numberField.Description = "";
                    numberField.HelpText = "";
                    numberField.Required = true;
                    numberField.Unique = false;
                    numberField.Searchable = false;
                    numberField.Auditable = false;
                    numberField.System = true;
                    numberField.DefaultValue = 0;
                    numberField.MinValue = 0;
                    numberField.MaxValue = null;
                    numberField.DecimalPlaces = 2;
                    numberField.EnableSecurity = true;
                    numberField.Permissions = new FieldPermissions();
                    numberField.Permissions.CanRead = new List<Guid>();
                    numberField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    numberField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    numberField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    numberField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TIMELOG_ENTITY_ID, numberField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Field: hours" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << description >>
                {
                    InputMultiLineTextField textareaField = new InputMultiLineTextField();
                    textareaField.Id = new Guid("1a1b646e-93df-4035-ace0-d844f62bad63");
                    textareaField.Name = "description";
                    textareaField.Label = "Description";
                    textareaField.PlaceholderText = "";
                    textareaField.Description = "";
                    textareaField.HelpText = "";
                    textareaField.Required = false;
                    textareaField.Unique = false;
                    textareaField.Searchable = false;
                    textareaField.Auditable = false;
                    textareaField.System = true;
                    textareaField.DefaultValue = " ";
                    textareaField.VisibleLineNumber = null;
                    textareaField.EnableSecurity = true;
                    textareaField.Permissions = new FieldPermissions();
                    textareaField.Permissions.CanRead = new List<Guid>();
                    textareaField.Permissions.CanUpdate = new List<Guid>();

                    textareaField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textareaField.Permissions.CanRead.Add(SystemIds.RegularRoleId);

                    textareaField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    textareaField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);

                    {
                        var response = entMan.CreateField(TIMELOG_ENTITY_ID, textareaField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Field: description" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << log_date >>
                {
                    InputDateField dateField = new InputDateField();
                    dateField.Id = new Guid("29a32ad7-7b1c-4ea0-a06b-57b30be9b107");
                    dateField.Name = "log_date";
                    dateField.Label = "Log date";
                    dateField.PlaceholderText = "";
                    dateField.Description = "";
                    dateField.HelpText = "";
                    dateField.Required = true;
                    dateField.Unique = false;
                    dateField.Searchable = false;
                    dateField.Auditable = false;
                    dateField.System = true;
                    dateField.DefaultValue = null;
                    dateField.Format = "dd MMM yyyy";
                    dateField.UseCurrentTimeAsDefaultValue = true;
                    dateField.EnableSecurity = true;
                    dateField.Permissions = new FieldPermissions();
                    dateField.Permissions.CanRead = new List<Guid>();
                    dateField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dateField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dateField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dateField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TIMELOG_ENTITY_ID, dateField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Field: log_date" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("d256d5f7-4af7-4d62-b265-e4509319d700");
                    guidField.Name = "task_id";
                    guidField.Label = "Parent task";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TIMELOG_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Field: task_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << bug_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("f1b9a8f3-ab8d-4de0-8503-df3165ad7969");
                    guidField.Name = "bug_id";
                    guidField.Label = "Parent bug";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(TIMELOG_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Field: bug_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_1_n_time_log Relation >>
                {
                    var originEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("61f1cd54-bcd6-4061-9c96-7934e01f0857");
                    oneToNRelation.Name = "task_1_n_time_log";
                    oneToNRelation.Label = "task_1_n_time_log";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "task_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE task_1_n_time_log RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << bug_1_n_time_log Relation >>
                {
                    var originEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("97909e49-50d4-4534-aa7b-61c523b55d87");
                    oneToNRelation.Name = "bug_1_n_time_log";
                    oneToNRelation.Label = "bug_1_n_time_log";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "bug_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE bug_1_n_time_log RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << List name: task_timelogs >>
                {
                    var createListEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("c105b3f8-e140-4150-a587-a31cf600d99b");
                    createListInput.Type = "hidden";
                    createListInput.Name = "task_timelogs";
                    createListInput.Label = "Time logs";
                    createListInput.Weight = 25;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "clock-o";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = "160px,160px,80px,auto";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << log_date >>
                    {
                        var fieldName = "log_date";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_timelog_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_timelog_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.FieldLabel = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << hours >>
                    {
                        var fieldName = "hours";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << description >>
                    {
                        var fieldName = "description";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "log_date";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(TIMELOG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Updated List: task_timelogs" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: bug_timelogs >>
                {
                    var createListEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("f9a12626-08db-4fd2-a443-b521162be2b5");
                    createListInput.Type = "hidden";
                    createListInput.Name = "bug_timelogs";
                    createListInput.Label = "Time logs";
                    createListInput.Weight = 25;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "clock-o";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = "160px,160px,80px,auto";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var fieldName = "log_date";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_timelog_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_timelog_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.FieldLabel = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << hours >>
                    {
                        var fieldName = "hours";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << description >>
                    {
                        var fieldName = "description";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "log_date";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(TIMELOG_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Updated List: task_timelogs" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create create >>
                {
                    var createViewEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("e33d960c-4867-48f2-bfc2-4f532aa2513d");
                    createViewInput.Name = "create";
                    createViewInput.Label = "Create";
                    createViewInput.Title = "";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.Type = "create";
                    createViewInput.Weight = 10;
                    createViewInput.IconName = "file-text-o";
                    createViewInput.ServiceCode = null;
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    #endregion

                    #region << Get the header Region >>
                    var headerRegion = new InputRecordViewRegion();
                    headerRegion.Name = "header";
                    headerRegion.Label = "header";
                    headerRegion.Sections = new List<InputRecordViewSection>();
                    #endregion

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("559e8b4a-2ae5-4be7-8a87-805faeafeac4");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("6c769b09-045b-4826-a791-83812f6ded1b");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << hours >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "hours").Id;
                        viewItem.FieldName = "hours";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    #region << hours >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "log_date").Id;
                        viewItem.FieldName = "log_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    #region << Column 2 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 6;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << subject >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "billable").Id;
                        viewItem.FieldName = "billable";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    #region << Row 2 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("57e71de9-8cb4-4343-bcec-5a0152f08dbd");
                    viewRow.Weight = 2;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << description >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    headerRegion.Sections.Add(viewSection);

                    #endregion

                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    createViewInput.Regions.Add(headerRegion);

                    #region << Sidebar >>
                    var sidebarItem = new InputRecordViewSidebarItemBase();
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    #region << Action items>
                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                        actionItem.Weight = 2;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }

                    createViewInput.ActionItems = newActionItemList;
                    #endregion

                    {
                        var response = entMan.CreateRecordView(TIMELOG_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + TIMELOG_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion
            }
            #endregion

            #region << wv_project_attachment >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = ATTACHMENT_ENTITY_ID;
                    entity.Name = ATTACHMENT_ENTITY_NAME;
                    entity.Label = "Attachment";
                    entity.LabelPlural = "Attachments";
                    entity.System = true;
                    entity.IconName = "paperclip";
                    entity.Weight = 10;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //DELETE
                    entity.RecordPermissions.CanDelete.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanDelete.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("a965c8b6-83fb-43a0-a156-e8b58e4e51a5");
                    systemItemIdDictionary["created_on"] = new Guid("381de04c-fad1-46b6-aa11-59bf7822a9a5");
                    systemItemIdDictionary["created_by"] = new Guid("c8216ce8-5661-4a47-a03f-9cce93e943e1");
                    systemItemIdDictionary["last_modified_on"] = new Guid("7bb58634-82ce-4b29-9a99-9ec1e8ea03dc");
                    systemItemIdDictionary["last_modified_by"] = new Guid("c754a57c-4807-4cc8-9c63-6bcef8d09a7f");
                    systemItemIdDictionary["user_wv_project_attachment_created_by"] = new Guid("97fe4c22-b090-4d8d-b9df-39d3e04a5865");
                    systemItemIdDictionary["user_wv_project_attachment_modified_by"] = new Guid("b3f1f810-dd2d-4e9a-85d1-8e44746fbbdd");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + ATTACHMENT_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << file >>
                {
                    InputFileField fileField = new InputFileField();
                    fileField.Id = new Guid("6d639a8c-e220-4d9f-86f0-de6ba03030b8");
                    fileField.Name = "file";
                    fileField.Label = "File";
                    fileField.PlaceholderText = "";
                    fileField.Description = "";
                    fileField.HelpText = "";
                    fileField.Required = true;
                    fileField.Unique = false;
                    fileField.Searchable = false;
                    fileField.Auditable = false;
                    fileField.System = true;
                    fileField.DefaultValue = string.Empty;
                    fileField.EnableSecurity = true;
                    fileField.Permissions = new FieldPermissions();
                    fileField.Permissions.CanRead = new List<Guid>();
                    fileField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    fileField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    fileField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    fileField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    fileField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ATTACHMENT_ENTITY_ID, fileField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Field: file" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("841f6741-a7a6-4f52-9b45-31c4bf2e96ae");
                    guidField.Name = "task_id";
                    guidField.Label = "Parent task";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ATTACHMENT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Field: task_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << bug_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("8a389111-cee3-4da0-986f-bcdc5f179924");
                    guidField.Name = "bug_id";
                    guidField.Label = "Parent bug";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ATTACHMENT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Field: bug_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("151b03a4-156e-4500-a6ff-4431f67e500f");
                    guidField.Name = "project_id";
                    guidField.Label = "Project";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ATTACHMENT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Field: project_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_1_n_attachment Relation >>
                {
                    var originEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("f79f76e2-06b1-463a-9675-63845814bf22");
                    oneToNRelation.Name = "task_1_n_attachment";
                    oneToNRelation.Label = "task_1_n_attachment";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "task_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE task_1_n_attachment RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << bug_1_n_attachment Relation >>
                {
                    var originEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("a4f60f87-66a9-4541-a2ef-29e00f2b418b");
                    oneToNRelation.Name = "bug_1_n_attachment";
                    oneToNRelation.Label = "bug_1_n_attachment";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "bug_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE bug_1_n_attachment RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << project_1_n_attachment Relation >>
                {
                    var originEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("d20a4341-76d5-4537-91a0-c264824ff76c");
                    oneToNRelation.Name = "project_1_n_attachment";
                    oneToNRelation.Label = "project_1_n_attachment";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "project_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE project_1_n_attachment RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << general list -> bug_attachments >>
                {
                    var createListEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    //General list details
                    createListInput.Id = new Guid("2b83e4e3-6878-4b5b-9391-6e59429c0b5e");
                    createListInput.Name = "bug_attachments";
                    createListInput.Label = "Attachments";
                    createListInput.IconName = "paperclip";
                    createListInput.Type = "general";
                    createListInput.Weight = 10;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "paperclip";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = "160px,160px,auto";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    createListInput.Columns = new List<InputRecordListItemBase>();
                    #region << created_on >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "created_on").Id;
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << created_by_username >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_attachment_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << file >>
                    {
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == "file").Id;
                        listField.FieldName = "file";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    //Query
                    #region << query descr >>
                    {
                    }
                    #endregion

                    //Action items
                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline hidden-xs\" ng-show=\"::ngCtrl.userHasRecordPermissions('canCreate')\" \n    ng-href=\"{{::ngCtrl.getRecordCreateUrl()}}\">Add New</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    createListInput.ActionItems = newActionItemList;

                    //Sort
                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    {
                        listSort = new InputRecordListSort();
                        listSort.FieldName = "created_on";
                        listSort.SortType = "ascending";
                        createListInput.Sorts.Add(listSort);
                    }
                    #endregion
                    {
                        var response = entMan.CreateRecordList(ATTACHMENT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Updated List: general" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: task_attachments >>
                {
                    var createListEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("6fc374ac-ba6b-4009-ade4-988304071f29");
                    createListInput.Type = "hidden";
                    createListInput.Name = "task_attachments";
                    createListInput.Label = "Attachments";
                    createListInput.Weight = 10;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "paperclip";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = "160px,160px,auto";
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                        ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var fieldName = "created_on";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    //Field from relation
                    #region << user_wv_project_attachment_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_attachment_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << file >>
                    {
                        var fieldName = "file";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "created_on";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(ATTACHMENT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Updated List: task_attachment" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << create create >>
                {
                    var createViewEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    var createViewInput = new InputRecordView();
                    var viewSection = new InputRecordViewSection();
                    var viewRow = new InputRecordViewRow();
                    var viewColumn = new InputRecordViewColumn();
                    var viewItem = new InputRecordViewFieldItem();
                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    //General view fields

                    #region << Details >>
                    createViewInput.Id = new Guid("4a049b10-ac21-4402-9984-3b0b8cf015be");
                    createViewInput.Name = "create";
                    createViewInput.Label = "Create";
                    createViewInput.Title = "";
                    createViewInput.Default = true;
                    createViewInput.System = true;
                    createViewInput.Type = "create";
                    createViewInput.Weight = 10;
                    createViewInput.IconName = "file-text-o";
                    createViewInput.ServiceCode = null;
                    createViewInput.DynamicHtmlTemplate = null;
                    createViewInput.DataSourceUrl = null;
                    #endregion

                    #region << Get the header Region >>
                    var headerRegion = new InputRecordViewRegion();
                    headerRegion.Name = "header";
                    headerRegion.Label = "header";
                    headerRegion.Sections = new List<InputRecordViewSection>();
                    #endregion

                    #region << Section >>
                    viewSection = new InputRecordViewSection();
                    viewSection.Id = new Guid("8ea140f9-b6fc-4b61-bc50-38b4e92f9eae");
                    viewSection.Name = "details";
                    viewSection.Label = "Details";
                    viewSection.ShowLabel = false;
                    viewSection.CssClass = "";
                    viewSection.Collapsed = false;
                    viewSection.TabOrder = "left-right";
                    viewSection.Weight = 1;
                    viewSection.Rows = new List<InputRecordViewRow>();

                    #region << Row 1 >>
                    viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("84482250-9a74-43d2-ae20-c883ee82a865");
                    viewRow.Weight = 1;
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = 12;
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << subject >>
                    {
                        viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = createViewEntity.Id;
                        viewItem.EntityName = createViewEntity.Name;
                        viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "file").Id;
                        viewItem.FieldName = "file";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion

                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    #endregion

                    //Save row
                    viewSection.Rows.Add(viewRow);
                    #endregion

                    //Save section
                    headerRegion.Sections.Add(viewSection);

                    #endregion

                    createViewInput.Regions = new List<InputRecordViewRegion>();
                    createViewInput.Regions.Add(headerRegion);

                    #region << Sidebar >>
                    var sidebarItem = new InputRecordViewSidebarItemBase();
                    createViewInput.Sidebar = new InputRecordViewSidebar();
                    createViewInput.Sidebar.CssClass = "";
                    createViewInput.Sidebar.Render = true;

                    #endregion

                    var newActionItemList = new List<ActionItem>();
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                        actionItem.Weight = 1;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click='ngCtrl.create(\"details\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create & Details</a>";
                        actionItem.Weight = 2;
                        newActionItemList.Add(actionItem);
                    }
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                        actionItem.Weight = 3;
                        newActionItemList.Add(actionItem);
                    }
                    createViewInput.ActionItems = newActionItemList;

                    {
                        var response = entMan.CreateRecordView(ATTACHMENT_ENTITY_ID, createViewInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ATTACHMENT_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                    }
                }
                #endregion

            }
            #endregion

            #region << wv_project_activity >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = ACTIVITY_ENTITY_ID;
                    entity.Name = ACTIVITY_ENTITY_NAME;
                    entity.Label = "Activity";
                    entity.LabelPlural = "Activities";
                    entity.System = true;
                    entity.IconName = "comments-o";
                    entity.Weight = 7;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);

                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("0aac0f03-4153-47ed-b3a5-95371f46bb1e");
                    systemItemIdDictionary["created_on"] = new Guid("f4d890fd-c3ed-4ea6-9b91-4bd55fe688c7");
                    systemItemIdDictionary["created_by"] = new Guid("1605ec95-ffec-4c66-ba6e-b1e457936306");
                    systemItemIdDictionary["last_modified_on"] = new Guid("540dfdfb-02aa-47d8-8312-0a887ab092e3");
                    systemItemIdDictionary["last_modified_by"] = new Guid("80e7f499-cddd-4498-946a-e3972ee98a15");
                    systemItemIdDictionary["user_wv_project_activity_created_by"] = new Guid("2fd1e3a2-feea-4b2b-a609-d3a5d6694cbb");
                    systemItemIdDictionary["user_wv_project_activity_modified_by"] = new Guid("bc6314f8-fdf1-4b24-b5f5-574b04f45366");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + ACTIVITY_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << label >>
                {
                    InputSelectField dropdownField = new InputSelectField();
                    dropdownField.Id = new Guid("fe4ee5da-8c32-4ecd-8773-04752b413cb0");
                    dropdownField.Name = "label";
                    dropdownField.Label = "Label";
                    dropdownField.PlaceholderText = "";
                    dropdownField.Description = "";
                    dropdownField.HelpText = "";
                    dropdownField.Required = false;
                    dropdownField.Unique = false;
                    dropdownField.Searchable = false;
                    dropdownField.Auditable = false;
                    dropdownField.System = true;
                    dropdownField.DefaultValue = "added";
                    dropdownField.Options = new List<SelectFieldOption>
                                {
                                    new SelectFieldOption(){ Key = "added", Value = "added" },
                                    new SelectFieldOption(){ Key = "created", Value = "created" },
                                    new SelectFieldOption(){ Key = "updated", Value = "updated" },
                                    new SelectFieldOption(){ Key = "deleted", Value = "deleted" },
                                    new SelectFieldOption(){ Key = "timelog", Value = "timelog" },
                                    new SelectFieldOption(){ Key = "commented", Value = "commented" }
                                };
                    dropdownField.EnableSecurity = true;
                    dropdownField.Permissions = new FieldPermissions();
                    dropdownField.Permissions.CanRead = new List<Guid>();
                    dropdownField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    dropdownField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    dropdownField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ACTIVITY_ENTITY_ID, dropdownField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Field: label" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << subject >>
                {
                    InputTextField textboxField = new InputTextField();
                    textboxField.Id = new Guid("8f8b4cb9-aaed-4183-b863-b14faa2496ea");
                    textboxField.Name = "subject";
                    textboxField.Label = "Subject";
                    textboxField.PlaceholderText = "";
                    textboxField.Description = "";
                    textboxField.HelpText = "";
                    textboxField.Required = true;
                    textboxField.Unique = false;
                    textboxField.Searchable = false;
                    textboxField.Auditable = false;
                    textboxField.System = true;
                    textboxField.DefaultValue = string.Empty;
                    textboxField.MaxLength = null;
                    textboxField.EnableSecurity = true;
                    textboxField.Permissions = new FieldPermissions();
                    textboxField.Permissions.CanRead = new List<Guid>();
                    textboxField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    textboxField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ACTIVITY_ENTITY_ID, textboxField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Field: subject" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << description >>
                {
                    InputMultiLineTextField textareaField = new InputMultiLineTextField();
                    textareaField.Id = new Guid("6f29022e-c323-42fa-a4cb-76518787ba07");
                    textareaField.Name = "description";
                    textareaField.Label = "Description";
                    textareaField.PlaceholderText = "";
                    textareaField.Description = "";
                    textareaField.HelpText = "";
                    textareaField.Required = false;
                    textareaField.Unique = false;
                    textareaField.Searchable = false;
                    textareaField.Auditable = false;
                    textareaField.System = true;
                    textareaField.DefaultValue = string.Empty;
                    textareaField.VisibleLineNumber = 4;
                    textareaField.EnableSecurity = true;
                    textareaField.Permissions = new FieldPermissions();
                    textareaField.Permissions.CanRead = new List<Guid>();
                    textareaField.Permissions.CanUpdate = new List<Guid>();

                    textareaField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    textareaField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);

                    {
                        var response = entMan.CreateField(ACTIVITY_ENTITY_ID, textareaField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Field: description" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("c67b14eb-e23c-43d1-8fd2-869618390b16");
                    guidField.Name = "project_id";
                    guidField.Label = "Parent Project";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = true;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ACTIVITY_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Field: project_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("2f919a7c-0167-44bb-a6dc-5a942cc98442");
                    guidField.Name = "task_id";
                    guidField.Label = "Parent task";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ACTIVITY_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Field: task_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << bug_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("a490f567-a404-4300-be98-e8dde9d3a47e");
                    guidField.Name = "bug_id";
                    guidField.Label = "Parent bug";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(ACTIVITY_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Field: bug_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << project_1_n_activity Relation >>
                {
                    var originEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("f0894d81-1924-48a8-b8ee-213c90a5f524");
                    oneToNRelation.Name = "project_1_n_activity";
                    oneToNRelation.Label = "project_1_n_activity";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "project_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE project_1_n_activity RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << task_1_n_activity Relation >>
                {
                    var originEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("8f294277-fd60-496e-bff7-9391fffcda41");
                    oneToNRelation.Name = "task_1_n_activity";
                    oneToNRelation.Label = "task_1_n_activity";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "task_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE task_1_n_activity RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << bug_1_n_activity Relation >>
                {
                    var originEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("b96189f7-a880-4da4-b9a9-2274a9745d2d");
                    oneToNRelation.Name = "bug_1_n_activity";
                    oneToNRelation.Label = "bug_1_n_activity";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "bug_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE bug_1_n_activity RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << List name: task_activities >>
                {
                    var createListEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("121ce540-7838-4459-8357-d0d0ad2b65a4");
                    createListInput.Type = "hidden";
                    createListInput.Name = "task_activities";
                    createListInput.Label = "Activities";
                    createListInput.Weight = 30;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "history";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = null;
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var fieldName = "created_on";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_activity_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_activity_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var fieldName = "subject";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << label >>
                    {
                        var fieldName = "label";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_activity_created_by > image  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_activity_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_by >>
                    {
                        var fieldName = "created_by";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "created_on";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(ACTIVITY_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Updated List: task_activities" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: bug_activities >>
                {
                    var createListEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("57c3062c-df6e-488a-a432-dd927b0dd013");
                    createListInput.Type = "hidden";
                    createListInput.Name = "bug_activities";
                    createListInput.Label = "Activities";
                    createListInput.Weight = 30;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "history";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = null;
                    createListInput.PageSize = 10;
                    createListInput.DynamicHtmlTemplate = null;
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = null;
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var fieldName = "created_on";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_activity_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_activity_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << subject >>
                    {
                        var fieldName = "subject";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << label >>
                    {
                        var fieldName = "label";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_activity_created_by > image  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_activity_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_by >>
                    {
                        var fieldName = "created_by";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "created_on";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(ACTIVITY_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + ACTIVITY_ENTITY_NAME + " Updated List: task_activities" + " Message:" + response.Message);
                    }
                }
                #endregion

            }
            #endregion

            #region << wv_project_comment >>
            {
                #region << entity >>
                {
                    InputEntity entity = new InputEntity();
                    entity.Id = COMMENT_ENTITY_ID;
                    entity.Name = COMMENT_ENTITY_NAME;
                    entity.Label = "Comment";
                    entity.LabelPlural = "Comments";
                    entity.System = true;
                    entity.IconName = "comment-o";
                    entity.Weight = 17;
                    entity.RecordPermissions = new RecordPermissions();
                    entity.RecordPermissions.CanCreate = new List<Guid>();
                    entity.RecordPermissions.CanRead = new List<Guid>();
                    entity.RecordPermissions.CanUpdate = new List<Guid>();
                    entity.RecordPermissions.CanDelete = new List<Guid>();
                    //Create
                    entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanCreate.Add(SystemIds.RegularRoleId);
                    //READ
                    entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    entity.RecordPermissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    //System fields and relations Ids should be hardcoded for the compare/change code generation to work later on correctly
                    var systemItemIdDictionary = new Dictionary<string, Guid>();
                    systemItemIdDictionary["id"] = new Guid("4b10e607-b681-4650-a189-aab7c590aa62");
                    systemItemIdDictionary["created_on"] = new Guid("c205c60f-598a-4db7-bd41-a7fd2ae3abd0");
                    systemItemIdDictionary["created_by"] = new Guid("46208807-7bc8-4f54-8618-45134189e763");
                    systemItemIdDictionary["last_modified_on"] = new Guid("5be05bc8-f6ec-4e6d-82d4-4ea3c48cc60e");
                    systemItemIdDictionary["last_modified_by"] = new Guid("32e2a310-6613-4571-9fec-e592e1c4f333");
                    systemItemIdDictionary["user_wv_project_comment_created_by"] = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                    systemItemIdDictionary["user_wv_project_comment_modified_by"] = new Guid("98ae433b-8b2e-49c5-b10e-8615d92dfab5");
                    {
                        var response = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                        if (!response.Success)
                            throw new Exception("System error 10050. Entity: " + COMMENT_ENTITY_NAME + " Field: entity creation" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << content >>
                {
                    InputHtmlField htmlField = new InputHtmlField();
                    htmlField.Id = new Guid("23afb07b-438f-4e31-9372-c850a5789cc6");
                    htmlField.Name = "content";
                    htmlField.Label = "Content";
                    htmlField.PlaceholderText = "";
                    htmlField.Description = "";
                    htmlField.HelpText = "";
                    htmlField.Required = true;
                    htmlField.Unique = false;
                    htmlField.Searchable = false;
                    htmlField.Auditable = false;
                    htmlField.System = true;
                    htmlField.DefaultValue = string.Empty;
                    htmlField.EnableSecurity = true;
                    htmlField.Permissions = new FieldPermissions();
                    htmlField.Permissions.CanRead = new List<Guid>();
                    htmlField.Permissions.CanUpdate = new List<Guid>();

                    htmlField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    htmlField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    htmlField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(COMMENT_ENTITY_ID, htmlField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + COMMENT_ENTITY_ID + " Field: field_name" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("40068814-738f-4725-8aef-4722bc37ee7d");
                    guidField.Name = "task_id";
                    guidField.Label = "Parent task";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(COMMENT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + COMMENT_ENTITY_NAME + " Field: task_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << bug_id >>
                {
                    InputGuidField guidField = new InputGuidField();
                    guidField.Id = new Guid("6ac276d0-bb0c-4f8f-b30d-ea373cb64b73");
                    guidField.Name = "bug_id";
                    guidField.Label = "Parent bug";
                    guidField.PlaceholderText = "";
                    guidField.Description = "";
                    guidField.HelpText = "";
                    guidField.Required = false;
                    guidField.Unique = false;
                    guidField.Searchable = false;
                    guidField.Auditable = false;
                    guidField.System = true;
                    guidField.DefaultValue = Guid.Empty;
                    guidField.GenerateNewId = false;
                    guidField.EnableSecurity = true;
                    guidField.Permissions = new FieldPermissions();
                    guidField.Permissions.CanRead = new List<Guid>();
                    guidField.Permissions.CanUpdate = new List<Guid>();
                    //READ
                    guidField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                    //UPDATE
                    guidField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                    guidField.Permissions.CanUpdate.Add(SystemIds.RegularRoleId);
                    {
                        var response = entMan.CreateField(COMMENT_ENTITY_ID, guidField, false);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + COMMENT_ENTITY_NAME + " Field: bug_id" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << task_1_n_comment Relation >>
                {
                    var originEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(COMMENT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("884b9480-dc1c-468a-98f0-2d5f10084622");
                    oneToNRelation.Name = "task_1_n_comment";
                    oneToNRelation.Label = "task_1_n_comment";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "task_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE task_1_n_comment RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << bug_1_n_comment Relation >>
                {
                    var originEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var targetEntity = entMan.ReadEntity(COMMENT_ENTITY_ID).Object;
                    EntityRelation oneToNRelation = new EntityRelation();
                    oneToNRelation.Id = new Guid("5af026bd-d046-42ba-b6a0-e9090727348f");
                    oneToNRelation.Name = "bug_1_n_comment";
                    oneToNRelation.Label = "bug_1_n_comment";
                    oneToNRelation.System = true;
                    oneToNRelation.RelationType = EntityRelationType.OneToMany;
                    oneToNRelation.OriginEntityId = originEntity.Id;
                    oneToNRelation.OriginFieldId = originEntity.Fields.Single(x => x.Name == "id").Id;
                    oneToNRelation.TargetEntityId = targetEntity.Id;
                    oneToNRelation.TargetFieldId = targetEntity.Fields.Single(x => x.Name == "bug_id").Id;
                    {
                        var result = relMan.Create(oneToNRelation);
                        if (!result.Success)
                            throw new Exception("CREATE bug_1_n_comment RELATION:" + result.Message);
                    }
                }
                #endregion

                #region << List name: task_comments >>
                {
                    var createListEntity = entMan.ReadEntity(COMMENT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("b8a7a81d-9176-47e6-90c5-3cabc2a4ceff");
                    createListInput.Type = "hidden";
                    createListInput.Name = "task_comments";
                    createListInput.Label = "Comments";
                    createListInput.Weight = 10;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "comments-o";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = null;
                    createListInput.PageSize = 0;
                    createListInput.DynamicHtmlTemplate = @"/plugins/webvella-projects/templates/task-comments.html";
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = @"/plugins/webvella-projects/providers/task-comments.service.js";
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                    @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-click=""ngCtrl.actionService.manageComment(null,ngCtrl)"">Add Comment</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var fieldName = "created_on";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_comment_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_comment_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << file >>
                    {
                        var fieldName = "content";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_comment_created_by > image  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_comment_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_by >>
                    {
                        var fieldName = "created_by";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "created_on";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(COMMENT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + COMMENT_ENTITY_NAME + " Updated List: task_comments" + " Message:" + response.Message);
                    }
                }
                #endregion

                #region << List name: bug_comments >>
                {
                    var createListEntity = entMan.ReadEntity(COMMENT_ENTITY_ID).Object;
                    var createListInput = new InputRecordList();
                    var listField = new InputRecordListFieldItem();
                    var listFieldFromRelation = new InputRecordListRelationFieldItem();
                    var listSort = new InputRecordListSort();
                    var listQuery = new InputRecordListQuery();

                    #region << details >>
                    createListInput.Id = new Guid("b143b82f-b79f-47c1-87e7-ecba6f6f2a32");
                    createListInput.Type = "hidden";
                    createListInput.Name = "bug_comments";
                    createListInput.Label = "Comments";
                    createListInput.Weight = 10;
                    createListInput.Default = false;
                    createListInput.System = true;
                    createListInput.CssClass = null;
                    createListInput.IconName = "comments-o";
                    createListInput.VisibleColumnsCount = 5;
                    createListInput.ColumnWidthsCSV = null;
                    createListInput.PageSize = 0;
                    createListInput.DynamicHtmlTemplate = @"/plugins/webvella-projects/templates/bug-comments.html";
                    createListInput.DataSourceUrl = null;
                    createListInput.ServiceCode = @"/plugins/webvella-projects/providers/bug-comments.service.js";
                    #endregion

                    #region << action items >>
                    createListInput.ActionItems = new List<ActionItem>();
                    var actionItem = new ActionItem();
                    {
                        actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = 1;
                        actionItem.Template = "" +
                    @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-click=""ngCtrl.actionService.manageComment(null,ngCtrl)"">Add Comment</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }

                    #endregion

                    #region << Columns >>
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var fieldName = "created_on";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_comment_created_by > username  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_comment_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "username").Id;
                        listFieldFromRelation.FieldName = "username";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << file >>
                    {
                        var fieldName = "content";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #region << user_wv_project_comment_created_by > image  >>
                    {
                        var relatedEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                        var relation = relMan.Read("user_wv_project_comment_created_by").Object;
                        listFieldFromRelation = new InputRecordListRelationFieldItem();
                        listFieldFromRelation.EntityId = relatedEntity.Id;
                        listFieldFromRelation.EntityName = relatedEntity.Name;
                        listFieldFromRelation.FieldId = relatedEntity.Fields.Single(x => x.Name == "image").Id;
                        listFieldFromRelation.FieldName = "image";
                        listFieldFromRelation.Type = "field";
                        listFieldFromRelation.RelationId = relation.Id;
                        listFieldFromRelation.RelationName = relation.Name;
                        createListInput.Columns.Add(listFieldFromRelation);
                    }
                    #endregion

                    #region << created_by >>
                    {
                        var fieldName = "created_by";
                        listField = new InputRecordListFieldItem();
                        listField.EntityId = createListEntity.Id;
                        listField.EntityName = createListEntity.Name;
                        listField.FieldId = createListEntity.Fields.Single(x => x.Name == fieldName).Id;
                        listField.FieldName = fieldName;
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion

                    #endregion

                    #region << relation options >>
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                    #endregion

                    #region << Sort >>
                    createListInput.Sorts = new List<InputRecordListSort>();
                    listSort = new InputRecordListSort();
                    listSort.FieldName = "created_on";
                    listSort.SortType = "ascending";
                    createListInput.Sorts.Add(listSort);
                    #endregion
                    {
                        var response = entMan.CreateRecordList(COMMENT_ENTITY_ID, createListInput);
                        if (!response.Success)
                            throw new Exception("System error 10060. Entity: " + COMMENT_ENTITY_NAME + " Updated List: task_comments" + " Message:" + response.Message);
                    }
                }
                #endregion

            }
            #endregion

            #region << create project general view >>
            {
                var createViewEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                var createViewInput = new InputRecordView();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();
                var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                //General view fields

                #region << Details >>
                createViewInput.Id = new Guid("211f028b-4e8e-418f-9c0e-78109f0839fc");
                createViewInput.Type = "hidden";
                createViewInput.Label = "{name}";
                createViewInput.Title = "";
                createViewInput.Weight = 10;
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.Name = "general";
                createViewInput.Default = true;
                createViewInput.System = true;
                #endregion

                #region << Get the header Region >>
                var headerRegion = new InputRecordViewRegion();
                headerRegion.Name = "header";
                headerRegion.Label = "header";
                headerRegion.Sections = new List<InputRecordViewSection>();
                #endregion

                #region << Section >>
                viewSection = new InputRecordViewSection();
                viewSection.Id = new Guid("7848deef-6176-45ec-a12c-bb760793e9ef");
                viewSection.Name = "details";
                viewSection.Label = "Details";
                viewSection.ShowLabel = false;
                viewSection.CssClass = "";
                viewSection.Collapsed = false;
                viewSection.TabOrder = "left-right";
                viewSection.Weight = 1;
                viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row 1 Column>>
                viewRow = new InputRecordViewRow();
                viewRow.Id = new Guid("3a099857-dd26-4723-b0ee-f62ae47d7d93");
                viewRow.Weight = 1;
                viewRow.Columns = new List<InputRecordViewColumn>();

                #region << Column 1 >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 12;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << name >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = PROJECT_ENTITY_ID;
                    viewItem.EntityName = PROJECT_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItem.FieldName = "name";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                #region << description >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = PROJECT_ENTITY_ID;
                    viewItem.EntityName = PROJECT_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "description").Id;
                    viewItem.FieldName = "description";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                //Save row
                viewSection.Rows.Add(viewRow);
                #endregion

                #region << Row 2 Columns>>
                viewRow = new InputRecordViewRow();
                viewRow.Id = new Guid("b57588f0-9ca2-40b8-b516-3dd6d9efa0b5");
                viewRow.Weight = 1;
                viewRow.Columns = new List<InputRecordViewColumn>();

                #region << Column Left >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 6;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << $user_1_n_project_owner > username >>
                {
                    var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "field";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                    viewItemFromRelation.FieldName = "username";
                    viewItemFromRelation.FieldLabel = "Owner / Project manager";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = PROJECT_RELATION_USER_1_N_PROJECT_OWNER_ID;
                    viewItemFromRelation.RelationName = "user_1_n_project_owner";
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << $role_n_n_project_team > name >>
                {
                    var targetEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "field";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItemFromRelation.FieldName = "name";
                    viewItemFromRelation.FieldLabel = "Project team roles";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = PROJECT_RELATION_ROLE_N_N_PROJECT_TEAM_ID;
                    viewItemFromRelation.RelationName = "role_n_n_project_team";
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << start_date >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = PROJECT_ENTITY_ID;
                    viewItem.EntityName = PROJECT_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "start_date").Id;
                    viewItem.FieldName = "start_date";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                #region << Column right >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 6;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << $customer_1_n_project > name >>
                {
                    var targetEntity = entMan.ReadEntity(CUSTOMER_ENTITY_ID).Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "field";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItemFromRelation.FieldName = "name";
                    viewItemFromRelation.FieldLabel = "Customer";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = PROJECT_RELATION_CUSTOMER_1_N_PROJECT_ID;
                    viewItemFromRelation.RelationName = "customer_1_n_project";
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << $role_n_n_project_customer > name >>
                {
                    var targetEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "field";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItemFromRelation.FieldName = "name";
                    viewItemFromRelation.FieldLabel = "Project customer roles";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = PROJECT_RELATION_ROLE_N_N_PROJECT_CUSTOMER_ID;
                    viewItemFromRelation.RelationName = "role_n_n_project_customer";
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << end_date >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = PROJECT_ENTITY_ID;
                    viewItem.EntityName = PROJECT_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "end_date").Id;
                    viewItem.FieldName = "end_date";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                #region << code >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = PROJECT_ENTITY_ID;
                    viewItem.EntityName = PROJECT_ENTITY_NAME;
                    viewItem.FieldId = createViewEntity.Fields.Single(x => x.Name == "code").Id;
                    viewItem.FieldName = "code";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                //Save row
                viewSection.Rows.Add(viewRow);
                #endregion

                //Save section
                headerRegion.Sections.Add(viewSection);

                #endregion

                createViewInput.Regions = new List<InputRecordViewRegion>();
                createViewInput.Regions.Add(headerRegion);

                #region << Sidebar >>
                var sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;

                #endregion
                {
                    var response = entMan.CreateRecordView(PROJECT_ENTITY_ID, createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated view: general" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << create project create view >>
            {
                var createViewEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                var createViewInput = new InputRecordView();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();
                var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                //General view fields

                #region << Details >>
                createViewInput.Id = new Guid("43688004-69df-4c2f-9075-a3d4612f4b69");
                createViewInput.Type = "create";
                createViewInput.Label = "Create";
                createViewInput.Weight = 1;
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.Title = "";
                createViewInput.Name = "create";
                createViewInput.Default = true;
                createViewInput.System = true;
                #endregion

                #region << Get the header Region >>
                var headerRegion = new InputRecordViewRegion();
                headerRegion.Name = "header";
                headerRegion.Label = "header";
                headerRegion.Sections = new List<InputRecordViewSection>();
                #endregion

                createViewInput.Regions = new List<InputRecordViewRegion>();
                createViewInput.Regions.Add(headerRegion);

                #region << Sidebar >>
                var sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;

                var newActionItemList = new List<ActionItem>();
                {
                    var actionItem = new ActionItem();
                    actionItem.Name = "wv_back_button";
                    actionItem.Menu = "sidebar-top";
                    actionItem.Template = "<a class=\"back clearfix\" href=\"javascript:void(0)\" ng-click=\"sidebarData.goBack()\"><i class=\"fa fa-fw fa-arrow-left\"></i> <span class=\"text\">Back</span></a>";
                    actionItem.Weight = 1;
                    newActionItemList.Add(actionItem);
                }
                {
                    var actionItem = new ActionItem();
                    actionItem.Name = "wv_create_and_list";
                    actionItem.Menu = "create-bottom";
                    actionItem.Template = "<a class=\"btn btn-primary\" ng-click='ngCtrl.create(\"default\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create</a>";
                    actionItem.Weight = 1;
                    newActionItemList.Add(actionItem);
                }
                {
                    var actionItem = new ActionItem();
                    actionItem.Name = "wv_create_and_details";
                    actionItem.Menu = "create-bottom";
                    actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click='ngCtrl.create(\"details\")' ng-if=\"::ngCtrl.createViewRegion != null\">Create & Details</a>";
                    actionItem.Weight = 2;
                    newActionItemList.Add(actionItem);
                }
                {
                    var actionItem = new ActionItem();
                    actionItem.Name = "wv_create_cancel";
                    actionItem.Menu = "create-bottom";
                    actionItem.Template = "<a class=\"btn btn-default btn-outline\" ng-click=\"ngCtrl.cancel()\">Cancel</a>";
                    actionItem.Weight = 3;
                    newActionItemList.Add(actionItem);
                }

                createViewInput.ActionItems = newActionItemList;
                #endregion
                {
                    var response = entMan.CreateRecordView(PROJECT_ENTITY_ID, createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated view: create" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << update project dashboard view >>
            {
                var updateViewEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                var updateView = updateViewEntity.RecordViews.Single(x => x.Name == "dashboard");
                var updateViewInput = new InputRecordView();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();
                var viewItemFromRelation = new InputRecordViewRelationFieldItem();

                //Convert recordList to recordListInput
                updateViewInput = updateView.DynamicMapTo<InputRecordView>();
                updateViewInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/project-dashboard.html";

                #region << Get the header Region >>
                var headerRegion = new InputRecordViewRegion();
                foreach (var region in updateViewInput.Regions)
                {
                    if (region.Name == "header")
                    {
                        headerRegion = region;
                    }
                }
                headerRegion.Sections = new List<InputRecordViewSection>();
                #endregion

                #region << Sidebar >>
                var sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                var sidebarViewItem = new InputRecordViewSidebarViewItem();
                updateViewInput.Sidebar.CssClass = "";
                updateViewInput.Sidebar.Render = true;
                if(updateViewInput.Sidebar.Items == null) {
                    updateViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();
                }
                #region << Tasks >>
                {
                    var targetEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "project_tasks");
                    var targetRelation = relMan.Read(new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Tasks";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Milestone list >>
                {
                    var milestoneEntity = entMan.ReadEntity(MILESTONE_ENTITY_ID).Object;
                    var milestoneGeneralList = milestoneEntity.RecordLists.Single(x => x.Name == "project_milestones");
                    var projectMilestoneRelation = relMan.Read(new Guid("0c446f98-eec2-40c1-9d66-8a3c2a2498e9")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = MILESTONE_ENTITY_ID;
                    sidebarListFromRelationItem.EntityName = MILESTONE_ENTITY_NAME;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Milestones";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = milestoneGeneralList.Id;
                    sidebarListFromRelationItem.ListName = milestoneGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = projectMilestoneRelation.Id;
                    sidebarListFromRelationItem.RelationName = projectMilestoneRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Bugs >>
                {
                    var targetEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "project_bugs");
                    var targetRelation = relMan.Read(new Guid("d94f100c-024c-47e7-af32-d67a49be2b6c")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Bugs";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Project details >>
                {
                    var targetView = updateViewEntity.RecordViews.Single(x => x.Name == "general");
                    sidebarViewItem = new InputRecordViewSidebarViewItem();
                    sidebarViewItem.EntityId = updateViewEntity.Id;
                    sidebarViewItem.EntityName = updateViewEntity.Name;
                    sidebarViewItem.Type = "view";
                    sidebarViewItem.ViewId = targetView.Id;
                    sidebarViewItem.ViewName = targetView.Name;
                    updateViewInput.Sidebar.Items.Add(sidebarViewItem);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(PROJECT_ENTITY_ID, updateViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + PROJECT_ENTITY_NAME + " Updated view: dashboard" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << area add subscription: Project Workplace -> Project >>
            {
                var updatedAreaId = PROJECT_WORKPLACE_AREA_ID;
                var updateAreaResult = Helpers.UpsertEntityAsAreaSubscription(entMan, recMan, updatedAreaId, PROJECT_ENTITY_NAME, "dashboard", "create", "my_projects");
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << area add subscription: URL Dashboard -> Project >>
            {
                var updatedAreaId = PROJECT_WORKPLACE_AREA_ID;
                var updateAreaResult = Helpers.UpsertUrlAsAreaSubscription(entMan, recMan, updatedAreaId, "/#/areas/projects/wv_project/dashboard", "My Dashboard", 1, "tachometer");
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with id : " + updatedAreaId + " Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << update task general view >>
            {
                var updateViewEntity = entMan.ReadEntity(TASK_ENTITY_ID).Object;
                var updateView = updateViewEntity.RecordViews.Single(x => x.Name == "general");
                var updateViewInput = new InputRecordView();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();
                var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                //General view fields

                //Convert recordList to recordListInput
                updateViewInput = updateView.DynamicMapTo<InputRecordView>();

                #region << Get the header Region >>
                var headerRegion = new InputRecordViewRegion();
                foreach (var region in updateViewInput.Regions)
                {
                    if (region.Name == "header")
                    {
                        headerRegion = region;
                    }
                }
                #endregion

                #region << Sidebar >>
                var sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                var sidebarViewItem = new InputRecordViewSidebarViewItem();
                updateViewInput.Sidebar.CssClass = "";
                updateViewInput.Sidebar.Render = true;
                if(updateViewInput.Sidebar.Items == null) {
                    updateViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();
                }
                #region << Attachments >>
                {
                    var targetEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "task_attachments");
                    var targetRelation = relMan.Read(new Guid("f79f76e2-06b1-463a-9675-63845814bf22")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Attachments";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar = new InputRecordViewSidebar();
                    updateViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Comments >>
                {
                    var targetEntity = entMan.ReadEntity(COMMENT_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "task_comments");
                    var targetRelation = relMan.Read(new Guid("884b9480-dc1c-468a-98f0-2d5f10084622")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Comments";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Time logs >>
                {
                    var targetEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "task_timelogs");
                    var targetRelation = relMan.Read(new Guid("61f1cd54-bcd6-4061-9c96-7934e01f0857")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Time logs";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Activities >>
                {
                    var targetEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "task_activities");
                    var targetRelation = relMan.Read(new Guid("8f294277-fd60-496e-bff7-9391fffcda41")).Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Activities";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(TASK_ENTITY_ID, updateViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + TASK_ENTITY_NAME + " Updated view: general" + " Message:" + response.Message);
                }
            }
            #endregion

            #region << update bug general view >>
            {
                var updateViewEntity = entMan.ReadEntity(BUG_ENTITY_ID).Object;
                var updateView = updateViewEntity.RecordViews.Single(x => x.Name == "general");
                var updateViewInput = new InputRecordView();
                var viewSection = new InputRecordViewSection();
                var viewRow = new InputRecordViewRow();
                var viewColumn = new InputRecordViewColumn();
                var viewItem = new InputRecordViewFieldItem();
                var viewItemView = new InputRecordViewViewItem();
                var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                //General view fields

                //Convert recordList to recordListInput
                updateViewInput = updateView.DynamicMapTo<InputRecordView>();

                #region << Details >>
                updateViewInput.Label = "[{code}] {subject}";
                updateViewInput.IconName = "bug";
                updateViewInput.ServiceCode = "";
                #endregion

                #region << Get the header Region >>
                var headerRegion = new InputRecordViewRegion();
                foreach (var region in updateViewInput.Regions)
                {
                    if (region.Name == "header")
                    {
                        headerRegion = region;
                    }
                }
                headerRegion.Sections = new List<InputRecordViewSection>();
                #endregion

                #region << Section >>
                viewSection = new InputRecordViewSection();
                viewSection.Id = new Guid("b3679dee-d30d-46d7-b5ac-300ed8f1e922");
                viewSection.Name = "details";
                viewSection.Label = "Details";
                viewSection.ShowLabel = false;
                viewSection.CssClass = "";
                viewSection.Collapsed = false;
                viewSection.TabOrder = "left-right";
                viewSection.Weight = 1;
                viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row 1 >>
                viewRow = new InputRecordViewRow();
                viewRow.Id = new Guid("f9099d26-96ad-4fe2-9c81-db7a8f5daa47");
                viewRow.Weight = 1;
                viewRow.Columns = new List<InputRecordViewColumn>();

                #region << Column 1 >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 8;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << subject >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = updateViewEntity.Id;
                    viewItem.EntityName = updateViewEntity.Name;
                    viewItem.FieldId = updateViewEntity.Fields.Single(x => x.Name == "subject").Id;
                    viewItem.FieldName = "subject";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                #region << project name from Relation >>
                {
                    var targetEntity = entMan.ReadEntity(PROJECT_ENTITY_ID).Object;
                    var targetRelation = relMan.Read("project_1_n_bug").Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "fieldFromRelation";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "name").Id;
                    viewItemFromRelation.FieldName = "name";
                    viewItemFromRelation.FieldLabel = "Project";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = targetRelation.Id;
                    viewItemFromRelation.RelationName = targetRelation.Name;
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << description >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = updateViewEntity.Id;
                    viewItem.EntityName = updateViewEntity.Name;
                    viewItem.FieldId = updateViewEntity.Fields.Single(x => x.Name == "description").Id;
                    viewItem.FieldName = "description";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                #region << Column 2 >>
                viewColumn = new InputRecordViewColumn();
                viewColumn.GridColCount = 4;
                viewColumn.Items = new List<InputRecordViewItemBase>();

                #region << code >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = updateViewEntity.Id;
                    viewItem.EntityName = updateViewEntity.Name;
                    viewItem.FieldId = updateViewEntity.Fields.Single(x => x.Name == "code").Id;
                    viewItem.FieldName = "code";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                #region << status >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = updateViewEntity.Id;
                    viewItem.EntityName = updateViewEntity.Name;
                    viewItem.FieldId = updateViewEntity.Fields.Single(x => x.Name == "status").Id;
                    viewItem.FieldName = "status";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                #region << priority >>
                {
                    viewItem = new InputRecordViewFieldItem();
                    viewItem.EntityId = updateViewEntity.Id;
                    viewItem.EntityName = updateViewEntity.Name;
                    viewItem.FieldId = updateViewEntity.Fields.Single(x => x.Name == "priority").Id;
                    viewItem.FieldName = "priority";
                    viewItem.Type = "field";
                    viewColumn.Items.Add(viewItem);
                }
                #endregion

                #region << owner >>
                {
                    var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetRelation = relMan.Read("user_1_n_bug_owner").Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "fieldFromRelation";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                    viewItemFromRelation.FieldName = "username";
                    viewItemFromRelation.FieldLabel = "Owner";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = targetRelation.Id;
                    viewItemFromRelation.RelationName = targetRelation.Name;
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << watchers >>
                {
                    var targetEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                    var targetRelation = relMan.Read("user_n_n_bug_watchers").Object;
                    viewItemFromRelation = new InputRecordViewRelationFieldItem();
                    viewItemFromRelation.EntityId = targetEntity.Id;
                    viewItemFromRelation.EntityName = targetEntity.Name;
                    viewItemFromRelation.Type = "fieldFromRelation";
                    viewItemFromRelation.FieldId = targetEntity.Fields.Single(x => x.Name == "username").Id;
                    viewItemFromRelation.FieldName = "username";
                    viewItemFromRelation.FieldLabel = "Watchers";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldRequired = true;
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = targetRelation.Id;
                    viewItemFromRelation.RelationName = targetRelation.Name;
                    viewColumn.Items.Add(viewItemFromRelation);
                }
                #endregion
                //Save column
                viewRow.Columns.Add(viewColumn);
                #endregion

                //Save row
                viewSection.Rows.Add(viewRow);
                #endregion

                //Save section
                headerRegion.Sections.Add(viewSection);

                #endregion

                #region << Sidebar >>
                var sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                var sidebarViewItem = new InputRecordViewSidebarViewItem();
                updateViewInput.Sidebar = new InputRecordViewSidebar();
                updateViewInput.Sidebar.CssClass = "";
                updateViewInput.Sidebar.Render = true;
                if(updateViewInput.Sidebar.Items == null) {
                    updateViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();
                }

                #region << Attachments >>
                {
                    var targetEntity = entMan.ReadEntity(ATTACHMENT_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "bug_attachments");
                    var targetRelation = relMan.Read("bug_1_n_attachment").Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Attachments";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Comments >>
                {
                    var targetEntity = entMan.ReadEntity(COMMENT_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "bug_comments");
                    var targetRelation = relMan.Read("bug_1_n_comment").Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Comments";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Time logs >>
                {
                    var targetEntity = entMan.ReadEntity(TIMELOG_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "bug_timelogs");
                    var targetRelation = relMan.Read("bug_1_n_time_log").Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Time logs";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #region << Activities >>
                {
                    var targetEntity = entMan.ReadEntity(ACTIVITY_ENTITY_ID).Object;
                    var targetGeneralList = targetEntity.RecordLists.Single(x => x.Name == "bug_activities");
                    var targetRelation = relMan.Read("bug_1_n_activity").Object;
                    sidebarListFromRelationItem = new InputRecordViewSidebarRelationListItem();
                    sidebarListFromRelationItem.EntityId = targetEntity.Id;
                    sidebarListFromRelationItem.EntityName = targetEntity.Name;
                    sidebarListFromRelationItem.FieldHelpText = "";
                    sidebarListFromRelationItem.FieldLabel = "Activities";
                    sidebarListFromRelationItem.FieldLookupList = "lookup";
                    sidebarListFromRelationItem.FieldManageView = "general";
                    sidebarListFromRelationItem.FieldPlaceholder = "";
                    sidebarListFromRelationItem.FieldRequired = false;
                    sidebarListFromRelationItem.ListId = targetGeneralList.Id;
                    sidebarListFromRelationItem.ListName = targetGeneralList.Name;
                    sidebarListFromRelationItem.RelationId = targetRelation.Id;
                    sidebarListFromRelationItem.RelationName = targetRelation.Name;
                    sidebarListFromRelationItem.Type = "listFromRelation";
                    updateViewInput.Sidebar.Items.Add(sidebarListFromRelationItem);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(BUG_ENTITY_ID, updateViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: " + BUG_ENTITY_NAME + " Updated view: general" + " Message:" + response.Message);
                }
            }
            #endregion

            if (createSampleRecords)
            {
                #region << Create Project Team Role >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("083a5c46-7dbe-4ff9-b19f-44603671ccb2");
                    sampleRecord["name"] = "project_team";
                    sampleRecord["description"] = "Project team role for the Project application";
                    var createSampleRecordResult = recMan.CreateRecord(SystemIds.RoleEntityId, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample role record. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create Sample Project Manager User >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("b646c5d4-acc8-4404-af77-6786b81bee05");
                    sampleRecord["first_name"] = "Project";
                    sampleRecord["last_name"] = "Manager";
                    sampleRecord["username"] = "******";
                    sampleRecord["email"] = "*****@*****.**";
                    sampleRecord["password"] = "******";
                    sampleRecord["enabled"] = true;
                    sampleRecord["verified"] = true;
                    sampleRecord["image"] = "/plugins/webvella-core/assets/avatar-red.png";
                    var createSampleRecordResult = recMan.CreateRecord(SystemIds.UserEntityId, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample customer record. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create Sample Project Team User >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("6c820f13-f7d0-429e-a04a-c0ec3ba6ade0");
                    sampleRecord["first_name"] = "Project";
                    sampleRecord["last_name"] = "Team";
                    sampleRecord["username"] = "******";
                    sampleRecord["email"] = "*****@*****.**";
                    sampleRecord["password"] = "******";
                    sampleRecord["enabled"] = true;
                    sampleRecord["verified"] = true;
                    sampleRecord["image"] = "/plugins/webvella-core/assets/avatar-green.png";
                    var createSampleRecordResult = recMan.CreateRecord(SystemIds.UserEntityId, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample customer record. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create relation between project manager user and role >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("083a5c46-7dbe-4ff9-b19f-44603671ccb2"), new Guid("b646c5d4-acc8-4404-af77-6786b81bee05"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create relation between project manager user and regular role  >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("f16ec6db-626d-4c27-8de0-3e7ce542c55f"), new Guid("b646c5d4-acc8-4404-af77-6786b81bee05"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create relation between project team user and role >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("083a5c46-7dbe-4ff9-b19f-44603671ccb2"), new Guid("6c820f13-f7d0-429e-a04a-c0ec3ba6ade0"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create relation between project manager user and regular role  >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("f16ec6db-626d-4c27-8de0-3e7ce542c55f"), new Guid("6c820f13-f7d0-429e-a04a-c0ec3ba6ade0"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create relation between the system admin and project team role, so he can see the first project >>
                {
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(new Guid("0c4b119e-1d7b-4b40-8d2c-9e447cc656ab"), new Guid("083a5c46-7dbe-4ff9-b19f-44603671ccb2"), SystemIds.FirstUserId);
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create item image relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create Sample Project >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("a0141850-b13c-44b4-bb1b-4e0dde4850f4");
                    sampleRecord["name"] = "Corporate website development";
                    sampleRecord["description"] = "All activities for developing a sample application";
                    sampleRecord["code"] = "SMPL";
                    sampleRecord["billable_hour_price"] = 100;
                    sampleRecord["owner_id"] = new Guid("b646c5d4-acc8-4404-af77-6786b81bee05");
                    sampleRecord["customer_id"] = CUSTOMER_RECORD_ID;
                    var customerRoles = new List<Guid>();
                    customerRoles.Add(CUSTOMER_ROLE_ID);
                    sampleRecord["$$role_n_n_project_customer.id"] = customerRoles;
                    var projectTeamRoles = new List<Guid>();
                    projectTeamRoles.Add(new Guid("083a5c46-7dbe-4ff9-b19f-44603671ccb2"));
                    sampleRecord["$$role_n_n_project_team.id"] = projectTeamRoles;
                    sampleRecord["priority"] = "medium";
                    sampleRecord["status"] = "in review";
                    sampleRecord["start_date"] = DateTime.UtcNow.AddDays(3);
                    sampleRecord["end_date"] = DateTime.UtcNow.AddDays(90);
                    var createSampleRecordResult = recMan.CreateRecord(PROJECT_ENTITY_NAME, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample project. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Create Sample Milestone >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("42b881fc-d93f-46cf-b39d-391cd42fd2f6");
                    sampleRecord["name"] = "Specification documents development";
                    sampleRecord["start_date"] = DateTime.UtcNow.AddDays(3);
                    sampleRecord["status"] = "opened";
                    sampleRecord["end_date"] = DateTime.UtcNow.AddDays(90);
                    sampleRecord["project_id"] = new Guid("a0141850-b13c-44b4-bb1b-4e0dde4850f4");
                    var createSampleRecordResult = recMan.CreateRecord(MILESTONE_ENTITY_ID, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample milestone. Message:" + createSampleRecordResult.Message);
                    }

                }
                #endregion

                #region << Create Sample Task >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("70515386-7612-480d-99e6-76b97ca4190a");
                    sampleRecord["subject"] = "Corporate identity specification";
                    sampleRecord["owner_id"] = new Guid("b646c5d4-acc8-4404-af77-6786b81bee05");
                    sampleRecord["milestone_id"] = new Guid("42b881fc-d93f-46cf-b39d-391cd42fd2f6");
                    sampleRecord["description"] = "This is a sample task describing how to generate a corporate identity document";
                    sampleRecord["parent_id"] = null;
                    sampleRecord["code"] = "SMPL-T1";
                    sampleRecord["start_date"] = DateTime.UtcNow.AddDays(3);
                    sampleRecord["end_date"] = DateTime.UtcNow.AddDays(90);
                    sampleRecord["priority"] = "medium";
                    sampleRecord["status"] = "not started";
                    sampleRecord["x_billable_hours"] = 0;
                    sampleRecord["x_nonbillable_hours"] = 0;
                    sampleRecord["project_id"] = new Guid("a0141850-b13c-44b4-bb1b-4e0dde4850f4");
                    var createSampleRecordResult = recMan.CreateRecord(TASK_ENTITY_ID, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample task. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Add watchers to the task >>
                //Creator
                {
                    var targetRelation = relMan.Read("user_n_n_task_watchers").Object;
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(targetRelation.Id, SystemIds.FirstUserId, new Guid("70515386-7612-480d-99e6-76b97ca4190a"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create watch relation" + createRelationNtoNResponse.Message);
                    }
                }
                // Project manager
                {
                    var targetRelation = relMan.Read("user_n_n_task_watchers").Object;
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(targetRelation.Id, new Guid("b646c5d4-acc8-4404-af77-6786b81bee05"), new Guid("70515386-7612-480d-99e6-76b97ca4190a"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create watch relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Create Sample BUG >>
                {
                    var sampleRecord = new EntityRecord();
                    sampleRecord["id"] = new Guid("18934091-b4e4-4db4-8beb-678cd29b6916");
                    sampleRecord["subject"] = "Sample bug subject";
                    sampleRecord["owner_id"] = new Guid("b646c5d4-acc8-4404-af77-6786b81bee05");
                    sampleRecord["milestone_id"] = new Guid("42b881fc-d93f-46cf-b39d-391cd42fd2f6");
                    sampleRecord["description"] = "This is a sample bug about the project";
                    sampleRecord["priority"] = "medium";
                    sampleRecord["code"] = "SMPL-B1";
                    sampleRecord["status"] = "opened";
                    sampleRecord["x_billable_hours"] = 0;
                    sampleRecord["x_nonbillable_hours"] = 0;
                    sampleRecord["project_id"] = new Guid("a0141850-b13c-44b4-bb1b-4e0dde4850f4");
                    var createSampleRecordResult = recMan.CreateRecord(BUG_ENTITY_ID, sampleRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Create sample bug. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Add watchers to the bug >>
                //Creator
                {
                    var targetRelation = relMan.Read("user_n_n_bug_watchers").Object;
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(targetRelation.Id, SystemIds.FirstUserId, new Guid("18934091-b4e4-4db4-8beb-678cd29b6916"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create watch relation" + createRelationNtoNResponse.Message);
                    }
                }
                // Project manager
                {
                    var targetRelation = relMan.Read("user_n_n_bug_watchers").Object;
                    var createRelationNtoNResponse = recMan.CreateRelationManyToManyRecord(targetRelation.Id, new Guid("b646c5d4-acc8-4404-af77-6786b81bee05"), new Guid("18934091-b4e4-4db4-8beb-678cd29b6916"));
                    if (!createRelationNtoNResponse.Success)
                    {
                        throw new Exception("Could not create watch relation" + createRelationNtoNResponse.Message);
                    }
                }
                #endregion

                #region << Update the project >>
                {
                    var filterObj = EntityQuery.QueryEQ("id", new Guid("a0141850-b13c-44b4-bb1b-4e0dde4850f4"));
                    var resultQuery = new EntityQuery(PROJECT_ENTITY_NAME, "*", filterObj, null, null, null, null);
                    var updateResult = recMan.Find(resultQuery);
                    if (!updateResult.Success)
                    {
                        throw new Exception("Failed to update the project");
                    }
                    var updateRecord = updateResult.Object.Data[0];
                    updateRecord["x_milestones_opened"] = (decimal)updateRecord["x_milestones_opened"] + 1;
                    updateRecord["x_tasks_not_started"] = (decimal)updateRecord["x_tasks_not_started"] + 1;
                    updateRecord["x_bugs_opened"] = (decimal)updateRecord["x_bugs_opened"] + 1;
                    var createSampleRecordResult = recMan.UpdateRecord(PROJECT_ENTITY_ID, updateRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060.Update sample project. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion

                #region << Update the milestone >>
                {
                    var filterObj = EntityQuery.QueryEQ("id", new Guid("42b881fc-d93f-46cf-b39d-391cd42fd2f6"));
                    var resultQuery = new EntityQuery(MILESTONE_ENTITY_NAME, "*", filterObj, null, null, null, null);
                    var updateResult = recMan.Find(resultQuery);
                    if (!updateResult.Success)
                    {
                        throw new Exception("Failed to update the project");
                    }
                    var updateRecord = updateResult.Object.Data[0];
                    updateRecord["x_tasks_not_started"] = (decimal)updateRecord["x_tasks_not_started"] + 1;
                    updateRecord["x_bugs_opened"] = (decimal)updateRecord["x_bugs_opened"] + 1;
                    var createSampleRecordResult = recMan.UpdateRecord(MILESTONE_ENTITY_NAME, updateRecord);
                    if (!createSampleRecordResult.Success)
                    {
                        throw new Exception("System error 10060. Update sample milestone. Message:" + createSampleRecordResult.Message);
                    }
                }
                #endregion
            }
        }
Beispiel #18
0
        private static void Patch160610(EntityManager entMan, EntityRelationManager relMan, RecordManager recMan, bool createSampleRecords = false)
        {
            #region << Update area: project_admin >>
            {
                var patchObject = new EntityRecord();
                patchObject["id"] = new Guid("5b131255-46fc-459d-bbb5-923a4bdfc006");
                patchObject["attachments"] = "[{\"name\":\"wv_task\",\"label\":\"Task\",\"labelPlural\":\"Tasks\",\"iconName\":\"tasks\",\"weight\":4,\"url\":null,\"view\":{\"name\":\"general\",\"label\":\"[{code}] {subject}\"},\"create\":{\"name\":\"create\",\"label\":\"Create\"},\"list\":{\"name\":\"admin\",\"label\":\"All tasks\"}},{\"name\":\"wv_bug\",\"label\":\"Bug\",\"labelPlural\":\"Bugs\",\"iconName\":\"bug\",\"weight\":5,\"url\":null,\"view\":{\"name\":\"general\",\"label\":\"[{code}] {subject}\"},\"create\":{\"name\":\"create\",\"label\":\"Create\"},\"list\":{\"name\":\"admin\",\"label\":\"All Bugs\"}},{\"name\":\"wv_project\",\"label\":\"Project\",\"labelPlural\":\"Projects\",\"iconName\":\"product-hunt\",\"weight\":22,\"url\":null,\"view\":{\"name\":\"admin_details\",\"label\":\"Project details\"},\"create\":{\"name\":\"admin_create\",\"label\":\"Project create\"},\"list\":{\"name\":\"admin\",\"label\":\"All Projects\"}}]";
                var updateAreaResult = recMan.UpdateRecord("area", patchObject);
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with name : project_admin. Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << Update area: projects >>
            {
                var patchObject = new EntityRecord();
                patchObject["id"] = new Guid("205877a1-242c-41bf-a080-49ea01d4f519");
                patchObject["attachments"] = "[{\"name\":null,\"label\":\"My Dashboard\",\"labelPlural\":null,\"iconName\":\"tachometer\",\"weight\":1,\"url\":\"/#/areas/projects/wv_project/dashboard\",\"view\":null,\"create\":null,\"list\":null},{\"name\":\"wv_task\",\"label\":\"Task\",\"labelPlural\":\"Tasks\",\"iconName\":\"tasks\",\"weight\":4,\"url\":null,\"view\":{\"name\":\"general\",\"label\":\"[{code}] {subject}\"},\"create\":{\"name\":\"create\",\"label\":\"Create\"},\"list\":{\"name\":\"my_tasks\",\"label\":\"My Owned Active Tasks\"}},{\"name\":\"wv_bug\",\"label\":\"Bug\",\"labelPlural\":\"Bugs\",\"iconName\":\"bug\",\"weight\":5,\"url\":null,\"view\":{\"name\":\"general\",\"label\":\"[{code}] {subject}\"},\"create\":{\"name\":\"create\",\"label\":\"Create\"},\"list\":{\"name\":\"my_bugs\",\"label\":\"My Owned Open Bugs\"}},{\"name\":\"wv_project\",\"label\":\"Project\",\"labelPlural\":\"Projects\",\"iconName\":\"product-hunt\",\"weight\":22,\"url\":null,\"view\":{\"name\":\"dashboard\",\"label\":\"[{code}] {name}\"},\"create\":{\"name\":\"create\",\"label\":\"Create\"},\"list\":{\"name\":\"my_projects\",\"label\":\"My Projects\"}}]";
                var updateAreaResult = recMan.UpdateRecord("area", patchObject);
                if (!updateAreaResult.Success)
                {
                    throw new Exception("System error 10060. Area update with name : projects. Message:" + updateAreaResult.Message);
                }
            }
            #endregion

            #region << View  Enity: area name: create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("a81daf5f-46ed-4a22-8225-14fabd58be8d");
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "Create";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: area Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: area name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("284d2a04-9347-4769-a6f1-a6ee2cd211a7");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "General";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: area Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: area name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("0ce603bf-3f08-49c5-9e10-f260ad88becf");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "Quick create";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: area Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: area name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("ab14de6e-55be-49cf-b69d-68e588bda7a7");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "Quick view";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: area Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: area name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("e9a9c98a-bc0c-4b9e-901b-5bf9e3b4fb10");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = "General";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: area Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: area name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("28d11c7e-fb2f-47d3-a3c4-7343f5d63e2a");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "Lookup";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("cb434298-8583-4a96-bdbb-97b2c1764192"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: area Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_activity name: create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("128ee874-085e-436c-bc37-52209190a354");
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_activity name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("3505918b-7f44-4dc3-afd7-1360aee91841");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_activity name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("29a2cba8-4224-43d0-b5e3-0a2c33330f70");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_activity name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("e3289dae-b8a4-4054-8d3a-b9c9eaba894e");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project_activity name: task_activities >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "task_activities").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "task_activities";
                createListInput.Label = "Activities";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("30.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "history";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("f4d890fd-c3ed-4ea6-9b91-4bd55fe688c7");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2fd1e3a2-feea-4b2b-a609-d3a5d6694cbb");
                        listItemFromRelation.RelationName = "user_wv_project_activity_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("8f8b4cb9-aaed-4183-b863-b14faa2496ea");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << label >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("fe4ee5da-8c32-4ecd-8773-04752b413cb0");
                        listField.FieldName = "label";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2fd1e3a2-feea-4b2b-a609-d3a5d6694cbb");
                        listItemFromRelation.RelationName = "user_wv_project_activity_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_by >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("1605ec95-ffec-4c66-ba6e-b1e457936306");
                        listField.FieldName = "created_by";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "created_on";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Updated list: task_activities Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project_activity name: bug_activities >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "bug_activities").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "bug_activities";
                createListInput.Label = "Activities";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("30.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "history";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("f4d890fd-c3ed-4ea6-9b91-4bd55fe688c7");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2fd1e3a2-feea-4b2b-a609-d3a5d6694cbb");
                        listItemFromRelation.RelationName = "user_wv_project_activity_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("8f8b4cb9-aaed-4183-b863-b14faa2496ea");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << label >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("fe4ee5da-8c32-4ecd-8773-04752b413cb0");
                        listField.FieldName = "label";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2fd1e3a2-feea-4b2b-a609-d3a5d6694cbb");
                        listItemFromRelation.RelationName = "user_wv_project_activity_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_by >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0");
                        listField.EntityName = "wv_project_activity";
                        listField.FieldId = new Guid("1605ec95-ffec-4c66-ba6e-b1e457936306");
                        listField.FieldName = "created_by";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "created_on";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Updated list: bug_activities Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_project_activity name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("f4a42de5-6605-429d-bf95-e3f9db80c6f9");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_project_activity name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("f5d459d7-7c66-400a-a18a-3d65365b51de");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("145a489b-4dfc-4639-b473-2dedccb93ce0"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_activity Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_task name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("86640d72-a62f-4d9b-ab46-e86d7c6c1a28");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_task name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("a8a0b604-d117-48fc-8d3a-bb9be579190e");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("8b628f5d-16b3-49d0-a433-a910ea208b39");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("818f516c-f6c2-4073-8574-75c13a72aee4");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817");
                                    viewItemFromRelation.RelationName = "project_1_n_task";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("a00eb247-918a-46ba-9869-8d1168ea8f45");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        #region << Row 2>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("2144c60b-4974-44e2-86ef-5ceec72d04f8");
                            viewRow.Weight = Decimal.Parse("2.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task View: project_milestone >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "project_milestone").Id;
                createViewInput.Type = "Hidden";
                createViewInput.Name = "project_milestone";
                createViewInput.Label = "Project & Milestone";
                createViewInput.Title = "";
                createViewInput.Default = false;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = null;
                createViewInput.IconName = "code";
                createViewInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/task-project-milestone-selection.html";
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("1.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("e886ea83-cb6f-408e-9fa9-a53cd249b714");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("20be17ac-e915-4ac3-87a3-ab1ef534975f");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("d691b634-016c-46ef-8ba8-8c3328797497");
                                    viewItemFromRelation.EntityName = "wv_milestone";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("94cc3894-110a-4bb7-8c75-3e887cc83217");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Milestone";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("3b600a1c-066e-42e2-a678-0de4f0f8a9e1");
                                    viewItemFromRelation.RelationName = "milestone_1_n_task";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Milestone";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817");
                                    viewItemFromRelation.RelationName = "project_1_n_task";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: project_milestone Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task View: general >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "general").Id;
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "[{code}] {subject}";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "tasks";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = "";
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("0289b876-b6be-4d5f-915b-22dc0428bc25");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("cbf260ae-07e3-4e66-be57-beb7a36779bf");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("8");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << View: project_milestone >>
                                {
                                    var viewItem = new InputRecordViewViewItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.ViewId = new Guid("820b6771-3100-4393-982b-3813d79f4df2");
                                    viewItem.ViewName = "project_milestone";
                                    viewItem.Type = "view";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("a00eb247-918a-46ba-9869-8d1168ea8f45");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("4");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << code >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                                    viewItem.FieldName = "code";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Owner";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                                    viewItemFromRelation.RelationName = "user_1_n_task_owner";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                                    viewItem.EntityName = "wv_task";
                                    viewItem.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Watchers";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("de7e1578-8f8f-4454-a954-0fb62d3bf425");
                                    viewItemFromRelation.RelationName = "user_n_n_task_watchers";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #region << list from relation: task_attachments >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("6fc374ac-ba6b-4009-ade4-988304071f29");
                    viewItemFromRelation.ListName = "task_attachments";
                    viewItemFromRelation.FieldLabel = "Attachments";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("f79f76e2-06b1-463a-9675-63845814bf22");
                    viewItemFromRelation.RelationName = "task_1_n_attachment";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: task_comments >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("b8a7a81d-9176-47e6-90c5-3cabc2a4ceff");
                    viewItemFromRelation.ListName = "task_comments";
                    viewItemFromRelation.FieldLabel = "Comments";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("884b9480-dc1c-468a-98f0-2d5f10084622");
                    viewItemFromRelation.RelationName = "task_1_n_comment";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: task_timelogs >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("c105b3f8-e140-4150-a587-a31cf600d99b");
                    viewItemFromRelation.ListName = "task_timelogs";
                    viewItemFromRelation.FieldLabel = "Time logs";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("61f1cd54-bcd6-4061-9c96-7934e01f0857");
                    viewItemFromRelation.RelationName = "task_1_n_time_log";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: task_activities >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                    viewItemFromRelation.EntityName = "wv_task";
                    viewItemFromRelation.ListId = new Guid("121ce540-7838-4459-8357-d0d0ad2b65a4");
                    viewItemFromRelation.ListName = "task_activities";
                    viewItemFromRelation.FieldLabel = "Activities";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("8f294277-fd60-496e-bff7-9391fffcda41");
                    viewItemFromRelation.RelationName = "task_1_n_activity";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_task name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("62da6ee5-8c88-4c9a-a75c-bc1a2eb5c733");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task name: project_tasks >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "project_tasks").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "project_tasks";
                createListInput.Label = "Project Tasks";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = "task-list";
                createListInput.IconName = "tasks";
                createListInput.VisibleColumnsCount = Int32.Parse("6");
                createListInput.ColumnWidthsCSV = "auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listItemFromRelation.RelationName = "user_1_n_task_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")] = new InputRecordListQuery();
                        queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")].FieldName = "subject";
                        queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")].QueryType = "CONTAINS";
                        queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a"))) { queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")].SubQueries = subQueryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b"))) { subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")].Add(queryDictionary[new Guid("e8fd344c-be58-45c7-9b87-8388c7b4cb6a")]);
                    }
                    {
                        queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")] = new InputRecordListQuery();
                        queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")].FieldName = "status";
                        queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")].QueryType = "EQ";
                        queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11"))) { queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")].SubQueries = subQueryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b"))) { subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")].Add(queryDictionary[new Guid("bdcc6e9b-cb20-4d61-a944-e63b31110b11")]);
                    }
                    {
                        queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")] = new InputRecordListQuery();
                        queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")].FieldName = "priority";
                        queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")].QueryType = "EQ";
                        queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2"))) { queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")].SubQueries = subQueryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b"))) { subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")].Add(queryDictionary[new Guid("d89ceb3c-ea05-4f14-9b6d-8528c63868b2")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("ddeca57d-5267-4d75-987c-fe23de29ec0b")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated list: project_tasks Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task name: created_tasks >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "created_tasks").Id;
                createListInput.Type = "General";
                createListInput.Name = "created_tasks";
                createListInput.Label = "Tasks created by me";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("3.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "task-list";
                createListInput.IconName = "tasks";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listItemFromRelation.RelationName = "user_1_n_task_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")] = new InputRecordListQuery();
                        queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")].FieldName = null;
                        queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")].FieldValue = null;
                        queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")].QueryType = "AND";
                        queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")] = new InputRecordListQuery();
                            queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")].FieldName = "created_by";
                            queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")].FieldValue = "{\"name\":\"current_user\", \"option\": \"id\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")].QueryType = "EQ";
                            queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a"))) { queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")].SubQueries = subQueryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("5b755dcb-3318-46ca-8ae8-985760406942"))) { subQueryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")].Add(queryDictionary[new Guid("e5c8c5b9-013e-4264-8f3d-50b7b1ea624a")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("5b755dcb-3318-46ca-8ae8-985760406942"))) { queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")].SubQueries = subQueryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e"))) { subQueryDictionary[new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e")].Add(queryDictionary[new Guid("5b755dcb-3318-46ca-8ae8-985760406942")]);
                    }
                    {
                        queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")] = new InputRecordListQuery();
                        queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].FieldName = null;
                        queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].FieldValue = null;
                        queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].QueryType = "AND";
                        queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")] = new InputRecordListQuery();
                            queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")].FieldName = "code";
                            queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("58393565-3706-44ba-9553-1701dc8c545e"))) { queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")].SubQueries = subQueryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("add28557-f311-45cd-be24-063e65d32782"))) { subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].Add(queryDictionary[new Guid("58393565-3706-44ba-9553-1701dc8c545e")]);
                        }
                        {
                            queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")] = new InputRecordListQuery();
                            queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")].FieldName = "subject";
                            queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("931b9ad8-fda1-4080-a472-11013c80d790"))) { queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")].SubQueries = subQueryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("add28557-f311-45cd-be24-063e65d32782"))) { subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].Add(queryDictionary[new Guid("931b9ad8-fda1-4080-a472-11013c80d790")]);
                        }
                        {
                            queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")] = new InputRecordListQuery();
                            queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")].FieldName = "status";
                            queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")].QueryType = "EQ";
                            queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("09517e38-7099-4e51-8eb3-28a9956e310d"))) { queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")].SubQueries = subQueryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("add28557-f311-45cd-be24-063e65d32782"))) { subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].Add(queryDictionary[new Guid("09517e38-7099-4e51-8eb3-28a9956e310d")]);
                        }
                        {
                            queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")] = new InputRecordListQuery();
                            queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")].FieldName = "priority";
                            queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")].QueryType = "EQ";
                            queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6"))) { queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")].SubQueries = subQueryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("add28557-f311-45cd-be24-063e65d32782"))) { subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].Add(queryDictionary[new Guid("0a8f7332-0c4e-4820-9caa-84f9ebbfebd6")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("add28557-f311-45cd-be24-063e65d32782"))) { queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")].SubQueries = subQueryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e"))) { subQueryDictionary[new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e")].Add(queryDictionary[new Guid("add28557-f311-45cd-be24-063e65d32782")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("3cf020bd-7145-40e7-be4f-0dd50950789e")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated list: created_tasks Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task name: owned_tasks >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "owned_tasks").Id;
                createListInput.Type = "General";
                createListInput.Name = "owned_tasks";
                createListInput.Label = "Tasks owned by me";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("2.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "task-list";
                createListInput.IconName = "tasks";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listItemFromRelation.RelationName = "user_1_n_task_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")] = new InputRecordListQuery();
                        queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")].FieldName = null;
                        queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")].FieldValue = null;
                        queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")].QueryType = "OR";
                        queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")] = new InputRecordListQuery();
                            queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")].FieldName = "owner_id";
                            queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")].FieldValue = "{\"name\":\"current_user\", \"option\": \"id\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")].QueryType = "EQ";
                            queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("b3209fec-501e-422f-8797-f9539079ab5b"))) { queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")].SubQueries = subQueryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379"))) { subQueryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")].Add(queryDictionary[new Guid("b3209fec-501e-422f-8797-f9539079ab5b")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379"))) { queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")].SubQueries = subQueryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660"))) { subQueryDictionary[new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660")].Add(queryDictionary[new Guid("1e474d1c-ea0d-4023-93ca-8c49c483b379")]);
                    }
                    {
                        queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")] = new InputRecordListQuery();
                        queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].FieldName = null;
                        queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].FieldValue = null;
                        queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].QueryType = "AND";
                        queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")] = new InputRecordListQuery();
                            queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")].FieldName = "code";
                            queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")].FieldValue = "{\"name\":\"url_query\", \"option\": \"number\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("c3632319-0b00-4d00-b344-96d7efbac516"))) { queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")].SubQueries = subQueryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170"))) { subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].Add(queryDictionary[new Guid("c3632319-0b00-4d00-b344-96d7efbac516")]);
                        }
                        {
                            queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")] = new InputRecordListQuery();
                            queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")].FieldName = "subject";
                            queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d"))) { queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")].SubQueries = subQueryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170"))) { subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].Add(queryDictionary[new Guid("307283e8-2ae6-40ef-8158-c105a4685e8d")]);
                        }
                        {
                            queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")] = new InputRecordListQuery();
                            queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")].FieldName = "status";
                            queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")].QueryType = "EQ";
                            queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7"))) { queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")].SubQueries = subQueryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170"))) { subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].Add(queryDictionary[new Guid("8f622b34-9026-4ffe-bf4c-d2224e7641c7")]);
                        }
                        {
                            queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")] = new InputRecordListQuery();
                            queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")].FieldName = "priority";
                            queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")].QueryType = "EQ";
                            queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30"))) { queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")].SubQueries = subQueryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170"))) { subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].Add(queryDictionary[new Guid("40cb781a-e358-44e4-9d7d-33a1d54d8f30")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170"))) { queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")].SubQueries = subQueryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660"))) { subQueryDictionary[new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660")].Add(queryDictionary[new Guid("0ca0f816-fee2-4e2f-b333-9e7a3a501170")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("1146eff7-0b32-41c4-b3cf-608a64f7f660")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated list: owned_tasks Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task name: all_tasks >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "all_tasks").Id;
                createListInput.Type = "General";
                createListInput.Name = "all_tasks";
                createListInput.Label = "All Tasks";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("12.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "task-list";
                createListInput.IconName = "tasks";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = "/plugins/webvella-projects/api/task/list/all";
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                                            <i class=""fa fa-fw fa-eye""></i>
                                            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listItemFromRelation.RelationName = "user_1_n_task_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")] = new InputRecordListQuery();
                        queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")].FieldName = "code";
                        queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")].QueryType = "CONTAINS";
                        queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9"))) { queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")].SubQueries = subQueryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63"))) { subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")].Add(queryDictionary[new Guid("18aa08ba-eff8-4701-9be5-fb0ad7e087e9")]);
                    }
                    {
                        queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")] = new InputRecordListQuery();
                        queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")].FieldName = "subject";
                        queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")].QueryType = "CONTAINS";
                        queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0"))) { queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")].SubQueries = subQueryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63"))) { subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")].Add(queryDictionary[new Guid("d7667ece-67d5-4c5e-9417-d7b448098ba0")]);
                    }
                    {
                        queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")] = new InputRecordListQuery();
                        queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")].FieldName = "status";
                        queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")].QueryType = "EQ";
                        queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e"))) { queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")].SubQueries = subQueryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63"))) { subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")].Add(queryDictionary[new Guid("420788a4-4b22-4fcf-8a31-fb65ed2a145e")]);
                    }
                    {
                        queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")] = new InputRecordListQuery();
                        queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")].FieldName = "priority";
                        queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")].QueryType = "EQ";
                        queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("1761300b-bb55-4821-9084-a5c3622ae59b"))) { queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")].SubQueries = subQueryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63"))) { subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")].Add(queryDictionary[new Guid("1761300b-bb55-4821-9084-a5c3622ae59b")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("7a4e4ce2-ea93-49c9-9cbe-eab2d1f57c63")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated list: all_tasks Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task name: admin >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "admin").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "admin";
                createListInput.Label = "All tasks";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("2.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "task-list";
                createListInput.IconName = "tasks";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "80px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listItemFromRelation.RelationName = "user_1_n_task_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")] = new InputRecordListQuery();
                        queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")].FieldName = "owner_id";
                        queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")].QueryType = "EQ";
                        queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4"))) { queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")].SubQueries = subQueryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c"))) { subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")].Add(queryDictionary[new Guid("92e17b8c-82b7-4022-9976-6ab42b6be8b4")]);
                    }
                    {
                        queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")] = new InputRecordListQuery();
                        queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")].FieldName = "subject";
                        queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")].QueryType = "EQ";
                        queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7"))) { queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")].SubQueries = subQueryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c"))) { subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")].Add(queryDictionary[new Guid("1b3a6dd1-9c71-43d3-86ff-dbfa3ed944d7")]);
                    }
                    {
                        queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")] = new InputRecordListQuery();
                        queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")].FieldName = "status";
                        queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")].QueryType = "EQ";
                        queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("93a95605-b57a-4f56-91b4-96253aca3b75"))) { queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")].SubQueries = subQueryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c"))) { subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")].Add(queryDictionary[new Guid("93a95605-b57a-4f56-91b4-96253aca3b75")]);
                    }
                    {
                        queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")] = new InputRecordListQuery();
                        queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")].FieldName = "priority";
                        queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")].QueryType = "EQ";
                        queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("297cd5dd-022f-4e16-8417-258b8fa55828"))) { queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")].SubQueries = subQueryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c"))) { subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")].Add(queryDictionary[new Guid("297cd5dd-022f-4e16-8417-258b8fa55828")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("d97d66d8-be9f-45bb-a1d0-f3525653783c")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated list: admin Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_task name: my_tasks >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "my_tasks").Id;
                createListInput.Type = "General";
                createListInput.Name = "my_tasks";
                createListInput.Label = "My Owned Active Tasks";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("1.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "task-list";
                createListInput.IconName = "tasks";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04f31ad8-4583-4237-8d54-f82c3f44b918");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("7843bfbd-30c1-4438-af48-ffe56b7f294a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("7ce76c81-e604-401e-907f-23de982b930e");
                        listItemFromRelation.RelationName = "user_1_n_task_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("5bf852bf-5e6c-4791-bc8b-f1366440c04b");
                        listField.FieldName = "start_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("c6dc9db2-0081-4a91-b0e2-78f9c1c45a51");
                        listField.FieldName = "end_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("0702e611-6fe5-42e4-9bad-d549cba9cbb1");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("65acced0-1650-4ff0-bbff-9937c382cd89");
                        listField.EntityName = "wv_task";
                        listField.FieldId = new Guid("04ede478-99ec-4f7f-97af-0df3e89409b1");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")] = new InputRecordListQuery();
                        queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")].FieldName = null;
                        queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")].FieldValue = null;
                        queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")].QueryType = "AND";
                        queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")] = new InputRecordListQuery();
                            queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")].FieldName = "owner_id";
                            queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")].FieldValue = "{\"name\":\"current_user\", \"option\": \"id\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")].QueryType = "EQ";
                            queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510"))) { queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")].SubQueries = subQueryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("4e644905-b455-4988-9fe9-9a963821ce33"))) { subQueryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")].Add(queryDictionary[new Guid("5474b380-67df-4f34-91b9-ac92c8eaf510")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("4e644905-b455-4988-9fe9-9a963821ce33"))) { queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")].SubQueries = subQueryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92"))) { subQueryDictionary[new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92")].Add(queryDictionary[new Guid("4e644905-b455-4988-9fe9-9a963821ce33")]);
                    }
                    {
                        queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")] = new InputRecordListQuery();
                        queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].FieldName = null;
                        queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].FieldValue = null;
                        queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].QueryType = "AND";
                        queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")] = new InputRecordListQuery();
                            queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")].FieldName = "code";
                            queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e"))) { queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")].SubQueries = subQueryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc"))) { subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].Add(queryDictionary[new Guid("b917e36d-0042-4ed5-b785-6f757cb5599e")]);
                        }
                        {
                            queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")] = new InputRecordListQuery();
                            queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")].FieldName = "subject";
                            queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b"))) { queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")].SubQueries = subQueryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc"))) { subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].Add(queryDictionary[new Guid("425d99a5-e8ba-4db1-914e-f83f998bcf7b")]);
                        }
                        {
                            queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")] = new InputRecordListQuery();
                            queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")].FieldName = "status";
                            queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")].FieldValue = "completed";
                            queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")].QueryType = "NOT";
                            queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34"))) { queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")].SubQueries = subQueryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc"))) { subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].Add(queryDictionary[new Guid("0cbbad21-1ad2-4adb-822e-8dcb8eb26b34")]);
                        }
                        {
                            queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")] = new InputRecordListQuery();
                            queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")].FieldName = "priority";
                            queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")].QueryType = "EQ";
                            queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35"))) { queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")].SubQueries = subQueryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc"))) { subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].Add(queryDictionary[new Guid("9f2c586e-bd67-4d2e-98c1-27e3458f6d35")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc"))) { queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")].SubQueries = subQueryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92"))) { subQueryDictionary[new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92")].Add(queryDictionary[new Guid("f2d779ad-7878-45f3-ac8a-a190e156b8fc")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("f2433ee5-768d-4d83-8b75-4deedd5ced92")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("65acced0-1650-4ff0-bbff-9937c382cd89"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_task Updated list: my_tasks Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project View: admin_details >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "admin_details").Id;
                createViewInput.Type = "Hidden";
                createViewInput.Name = "admin_details";
                createViewInput.Label = "Project details";
                createViewInput.Title = "";
                createViewInput.Default = false;
                createViewInput.System = true;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = null;
                createViewInput.IconName = "product-hunt";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("1.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("6f8fdcc2-8a8f-4cf6-bf26-47bf1c6f0438");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("5d7ce054-f592-41e7-b8f1-424cfd6d38b7");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << name >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItem.FieldName = "name";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("d5e2c42c-c0b8-4f03-92e0-e91bede1e7b3");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        #region << Row 2>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("22d11cfc-a763-472b-b509-7ddfe36476bb");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Owner / Project manager";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("0cad07c3-73bd-4c1f-a5d6-552256f679a4");
                                    viewItemFromRelation.RelationName = "user_1_n_project_owner";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                                    viewItemFromRelation.EntityName = "role";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project team roles";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("4860a4b6-d07e-416f-b548-60491607e93f");
                                    viewItemFromRelation.RelationName = "role_n_n_project_team";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("417ce7d7-a472-499b-8e70-43a1cb54723d");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << billable_hour_price >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("7179f4ab-0376-4ded-a334-a21ff451538e");
                                    viewItem.FieldName = "billable_hour_price";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("90bcdb47-2cde-4137-a412-0198348fecc0");
                                    viewItemFromRelation.EntityName = "wv_customer";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Customer";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("d7f1ec35-9f59-4d75-b8a2-554c7eaeab11");
                                    viewItemFromRelation.RelationName = "customer_1_n_project";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                                    viewItemFromRelation.EntityName = "role";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project customer roles";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("e6d75feb-3c8f-410b-9ff4-54ef8489dc2f");
                                    viewItemFromRelation.RelationName = "role_n_n_project_customer";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("57198778-636d-47ec-b33e-edfc5705cc05");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << code >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("d9c6a939-e2e3-4617-900e-e056f0638fa8");
                                    viewItem.FieldName = "code";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
                                        ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
                                    <i class=""fa fa-trash go-red""></i> Delete Record
                                </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated view: admin_details Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = true;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project View: dashboard >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "dashboard").Id;
                createViewInput.Type = "General";
                createViewInput.Name = "dashboard";
                createViewInput.Label = "Dashboard";
                createViewInput.Title = "[{code}] {name}";
                createViewInput.Default = false;
                createViewInput.System = true;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = null;
                createViewInput.IconName = "tachometer";
                createViewInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/project-dashboard.html";
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("1.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
                                        ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
                                    <i class=""fa fa-trash go-red""></i> Delete Record
                                </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = true;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #region << list from relation: project_tasks >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                    viewItemFromRelation.EntityName = "wv_project";
                    viewItemFromRelation.ListId = new Guid("44f8ed83-b7e8-4223-b02e-b5e35ed4bcc1");
                    viewItemFromRelation.ListName = "project_tasks";
                    viewItemFromRelation.FieldLabel = "Tasks";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("1f860b8c-7fa1-40fa-874f-19c2b5309817");
                    viewItemFromRelation.RelationName = "project_1_n_task";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: project_milestones >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                    viewItemFromRelation.EntityName = "wv_project";
                    viewItemFromRelation.ListId = new Guid("92b40989-c3a2-4a06-869a-789fba54e733");
                    viewItemFromRelation.ListName = "project_milestones";
                    viewItemFromRelation.FieldLabel = "Milestones";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("0c446f98-eec2-40c1-9d66-8a3c2a2498e9");
                    viewItemFromRelation.RelationName = "project_1_n_milestone";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: project_bugs >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                    viewItemFromRelation.EntityName = "wv_project";
                    viewItemFromRelation.ListId = new Guid("3b2ebe34-1d02-448a-9616-5b62538fe2c7");
                    viewItemFromRelation.ListName = "project_bugs";
                    viewItemFromRelation.FieldLabel = "Bugs";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("d94f100c-024c-47e7-af32-d67a49be2b6c");
                    viewItemFromRelation.RelationName = "project_1_n_bug";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << View: general >>
                {
                    var viewItem = new InputRecordViewSidebarViewItem();
                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                    viewItem.EntityName = "wv_project";
                    viewItem.ViewId = new Guid("211f028b-4e8e-418f-9c0e-78109f0839fc");
                    viewItem.ViewName = "general";
                    viewItem.Type = "view";
                    createViewInput.Sidebar.Items.Add(viewItem);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated view: dashboard Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project View: general >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "general").Id;
                createViewInput.Type = "Hidden";
                createViewInput.Name = "general";
                createViewInput.Label = "Details";
                createViewInput.Title = "{name}";
                createViewInput.Default = true;
                createViewInput.System = true;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("7848deef-6176-45ec-a12c-bb760793e9ef");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("3a099857-dd26-4723-b0ee-f62ae47d7d93");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << name >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItem.FieldName = "name";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("d5e2c42c-c0b8-4f03-92e0-e91bede1e7b3");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        #region << Row 2>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("b57588f0-9ca2-40b8-b516-3dd6d9efa0b5");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Owner / Project manager";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("0cad07c3-73bd-4c1f-a5d6-552256f679a4");
                                    viewItemFromRelation.RelationName = "user_1_n_project_owner";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                                    viewItemFromRelation.EntityName = "role";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project team roles";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("4860a4b6-d07e-416f-b548-60491607e93f");
                                    viewItemFromRelation.RelationName = "role_n_n_project_team";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("417ce7d7-a472-499b-8e70-43a1cb54723d");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("90bcdb47-2cde-4137-a412-0198348fecc0");
                                    viewItemFromRelation.EntityName = "wv_customer";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Customer";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("d7f1ec35-9f59-4d75-b8a2-554c7eaeab11");
                                    viewItemFromRelation.RelationName = "customer_1_n_project";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                                    viewItemFromRelation.EntityName = "role";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project customer roles";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("e6d75feb-3c8f-410b-9ff4-54ef8489dc2f");
                                    viewItemFromRelation.RelationName = "role_n_n_project_customer";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("57198778-636d-47ec-b33e-edfc5705cc05");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << code >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItem.EntityName = "wv_project";
                                    viewItem.FieldId = new Guid("d9c6a939-e2e3-4617-900e-e056f0638fa8");
                                    viewItem.FieldName = "code";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("cd6d4f57-7940-47f8-8abd-ca3614a7aa2e");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = true;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("8d568f84-3600-4155-8a24-8daf20a270ef");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = true;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project name: admin >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "admin").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "admin";
                createListInput.Label = "All Projects";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("1.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "product-hunt";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << name >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        listField.EntityName = "wv_project";
                        listField.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                        listField.FieldName = "name";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project Updated list: admin Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: role name: create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("0fe76c7a-7e7e-4f3f-ab17-8a1df951901e");
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("c4541fee-fbb6-4661-929e-1724adec285a"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: role Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: role name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("2fe14937-8c2e-4d81-b5bf-9a39704f1e15");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("c4541fee-fbb6-4661-929e-1724adec285a"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: role Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: role name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("7f2778ac-a8eb-48e3-aeff-e27af018ac4f");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("c4541fee-fbb6-4661-929e-1724adec285a"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: role Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: role name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("d990148c-7a64-4a89-845d-2f09c6ef823a");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("c4541fee-fbb6-4661-929e-1724adec285a"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: role Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: role name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("9a3c30a6-ef9f-4e82-83c2-539d5be5f6a4");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("c4541fee-fbb6-4661-929e-1724adec285a"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: role Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: role name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("82bd4903-ef38-42e0-89bd-f4e84583d3c9");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << name >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        listField.EntityName = "role";
                        listField.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        listField.FieldName = "name";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "name";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("c4541fee-fbb6-4661-929e-1724adec285a"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: role Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: user name: create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("3e0d1e18-41fe-4e32-bfdf-97c283b6d25a");
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: user Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: user name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("15afe595-86b6-4d6d-9d61-087325fb5200");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: user Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: user name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("dfaa5588-9219-4717-9824-dafccb5a88fb");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: user Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: user name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("61dc420a-20d1-44a8-9ee8-76cbd9a35808");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: user Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: user name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("441a4578-2794-42d5-bb89-23d98abb6eaa");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: user Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: user name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("6440ed7f-8543-4854-862b-520fccaf4d68");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << username >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listField.EntityName = "user";
                        listField.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listField.FieldName = "username";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << email >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listField.EntityName = "user";
                        listField.FieldId = new Guid("9fc75c8f-ce80-4a64-81d7-e2befa5e4815");
                        listField.FieldName = "email";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")] = new InputRecordListQuery();
                        queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")].FieldName = "username";
                        queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")].FieldValue = "{\"name\":\"url_query\", \"option\": \"username\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")].QueryType = "CONTAINS";
                        queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a"))) { queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")].SubQueries = subQueryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e"))) { subQueryDictionary[new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e")].Add(queryDictionary[new Guid("395c11ee-3711-4c00-b9cd-1be5fd70a39a")]);
                    }
                    {
                        queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")] = new InputRecordListQuery();
                        queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")].FieldName = "email";
                        queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")].FieldValue = "{\"name\":\"url_query\", \"option\": \"email\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")].QueryType = "CONTAINS";
                        queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("15b73ded-1319-4d99-a088-13c95738e8a6"))) { queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")].SubQueries = subQueryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e"))) { subQueryDictionary[new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e")].Add(queryDictionary[new Guid("15b73ded-1319-4d99-a088-13c95738e8a6")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("9bcd88e6-6a4a-498b-ac48-306bf6366b7e")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "username";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: user Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_milestone name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d691b634-016c-46ef-8ba8-8c3328797497")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("ff807d26-7bc3-48f3-a29b-333fb1c3db1c");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d691b634-016c-46ef-8ba8-8c3328797497"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_milestone Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_milestone name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d691b634-016c-46ef-8ba8-8c3328797497")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("25cb0a1b-8413-457b-b21c-31909b673c9d");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d691b634-016c-46ef-8ba8-8c3328797497"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_milestone Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_milestone name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d691b634-016c-46ef-8ba8-8c3328797497")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("92bf4f9c-da49-4760-956a-992b48fbe3fd");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d691b634-016c-46ef-8ba8-8c3328797497"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_milestone Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_milestone View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("d691b634-016c-46ef-8ba8-8c3328797497")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("dd96bfb9-0dbc-4a6b-b7c6-92fb54b1844a");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("7f59d113-b469-4579-b780-961ead238e46");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << name >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("d691b634-016c-46ef-8ba8-8c3328797497");
                                    viewItem.EntityName = "wv_milestone";
                                    viewItem.FieldId = new Guid("94cc3894-110a-4bb7-8c75-3e887cc83217");
                                    viewItem.FieldName = "name";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << start_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("d691b634-016c-46ef-8ba8-8c3328797497");
                                    viewItem.EntityName = "wv_milestone";
                                    viewItem.FieldId = new Guid("9502a7e4-816c-433c-9f1e-6b1e2dffad62");
                                    viewItem.FieldName = "start_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("0c446f98-eec2-40c1-9d66-8a3c2a2498e9");
                                    viewItemFromRelation.RelationName = "project_1_n_milestone";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("d691b634-016c-46ef-8ba8-8c3328797497");
                                    viewItem.EntityName = "wv_milestone";
                                    viewItem.FieldId = new Guid("63eed358-9b33-4d2c-b2cd-b533413df227");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << end_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("d691b634-016c-46ef-8ba8-8c3328797497");
                                    viewItem.EntityName = "wv_milestone";
                                    viewItem.FieldId = new Guid("1252a300-c871-4d79-8242-f036705cc86d");
                                    viewItem.FieldName = "end_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("d691b634-016c-46ef-8ba8-8c3328797497"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_milestone Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_milestone name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("d691b634-016c-46ef-8ba8-8c3328797497")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("ba94f43b-79ef-4242-a2df-f9801bcacb9a");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("d691b634-016c-46ef-8ba8-8c3328797497"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_milestone Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_milestone name: project_milestones >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("d691b634-016c-46ef-8ba8-8c3328797497")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "project_milestones").Id;
                createListInput.Type = "General";
                createListInput.Name = "project_milestones";
                createListInput.Label = "Milestones";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = "map-signs";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/project-milestones.html";
                createListInput.DataSourceUrl = "/plugins/webvella-projects/api/project/milestones-list";
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("d691b634-016c-46ef-8ba8-8c3328797497"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_milestone Updated list: project_milestones Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_attachment name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("b373a9ab-9c2e-43bc-8ac9-5929e90380c5");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_attachment Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_attachment name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("33a245f4-d9f3-402a-a368-87eac4153fe1");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_attachment Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_attachment name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("39f4a027-62a9-462e-a66a-8f773886cc35");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_attachment Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project_attachment View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("8ea140f9-b6fc-4b61-bc50-38b4e92f9eae");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("84482250-9a74-43d2-ae20-c883ee82a865");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << file >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73");
                                    viewItem.EntityName = "wv_project_attachment";
                                    viewItem.FieldId = new Guid("6d639a8c-e220-4d9f-86f0-de6ba03030b8");
                                    viewItem.FieldName = "file";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_attachment Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_project_attachment name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("3a7b194e-ea07-4d4f-a09e-00475d089ada");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_attachment Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project_attachment name: task_attachments >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "task_attachments").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "task_attachments";
                createListInput.Label = "Attachments";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "paperclip";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = "160px,160px,auto";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                        ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73");
                        listField.EntityName = "wv_project_attachment";
                        listField.FieldId = new Guid("381de04c-fad1-46b6-aa11-59bf7822a9a5");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("97fe4c22-b090-4d8d-b9df-39d3e04a5865");
                        listItemFromRelation.RelationName = "user_wv_project_attachment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << file >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73");
                        listField.EntityName = "wv_project_attachment";
                        listField.FieldId = new Guid("6d639a8c-e220-4d9f-86f0-de6ba03030b8");
                        listField.FieldName = "file";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "created_on";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("f3dedc72-556a-4088-8278-bb5e8a8aad73"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_attachment Updated list: task_attachments Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_timelog field: description >>
            {
                var currentEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                InputMultiLineTextField textareaField = new InputMultiLineTextField();
                textareaField.Id = currentEntity.Fields.SingleOrDefault(x => x.Name == "description").Id;
                textareaField.Name = "description";
                textareaField.Label = "Description";
                textareaField.PlaceholderText = string.IsNullOrEmpty("") ? string.Empty : "";
                textareaField.Description = string.IsNullOrEmpty("") ? string.Empty : "";
                textareaField.HelpText = string.IsNullOrEmpty("") ? string.Empty : "";
                textareaField.Required = false;
                textareaField.Unique = false;
                textareaField.Searchable = false;
                textareaField.Auditable = false;
                textareaField.System = true;
                textareaField.DefaultValue = string.IsNullOrEmpty("") ? string.Empty : "";
                textareaField.MaxLength = string.IsNullOrEmpty("") ? (int?)null : Int32.Parse("");
                textareaField.VisibleLineNumber = string.IsNullOrEmpty("") ? (int?)null : Int32.Parse("");
                textareaField.EnableSecurity = true;
                textareaField.Permissions = new FieldPermissions();
                textareaField.Permissions.CanRead = new List<Guid>();
                textareaField.Permissions.CanUpdate = new List<Guid>();
                //READ
                textareaField.Permissions.CanRead.Add(new Guid("bdc56420-caf0-4030-8a0e-d264938e0cda"));
                textareaField.Permissions.CanRead.Add(new Guid("f16ec6db-626d-4c27-8de0-3e7ce542c55f"));
                //UPDATE
                textareaField.Permissions.CanUpdate.Add(new Guid("bdc56420-caf0-4030-8a0e-d264938e0cda"));
                textareaField.Permissions.CanUpdate.Add(new Guid("f16ec6db-626d-4c27-8de0-3e7ce542c55f"));
                {
                    var response = entMan.UpdateField(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), textareaField);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Field: description Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_timelog name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("a30d319d-42d0-44b7-b4ec-8c5883460e07");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_timelog name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("b9cfc363-9e08-4c13-9b6d-e5352f958f31");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_timelog name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("19dba00e-20d7-40a1-b784-c8852a076498");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_timelog View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("559e8b4a-2ae5-4be7-8a87-805faeafeac4");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("6c769b09-045b-4826-a791-83812f6ded1b");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << hours >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                                    viewItem.EntityName = "wv_timelog";
                                    viewItem.FieldId = new Guid("41caeb03-7430-4eb8-b830-c9df8bf2dc7f");
                                    viewItem.FieldName = "hours";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << log_date >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                                    viewItem.EntityName = "wv_timelog";
                                    viewItem.FieldId = new Guid("29a32ad7-7b1c-4ea0-a06b-57b30be9b107");
                                    viewItem.FieldName = "log_date";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << billable >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                                    viewItem.EntityName = "wv_timelog";
                                    viewItem.FieldId = new Guid("1f4b0729-4e31-4722-a8ce-3bf90c471dad");
                                    viewItem.FieldName = "billable";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        #region << Row 2>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("57e71de9-8cb4-4343-bcec-5a0152f08dbd");
                            viewRow.Weight = Decimal.Parse("2.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                                    viewItem.EntityName = "wv_timelog";
                                    viewItem.FieldId = new Guid("1a1b646e-93df-4035-ace0-d844f62bad63");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_timelog name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("5c6f5737-a0e2-4dc4-bb7d-746a2a6477b9");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_timelog name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("e7a5cd83-84de-482f-bb2f-bdcb65ccb61a");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_timelog name: bug_timelogs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "bug_timelogs").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "bug_timelogs";
                createListInput.Label = "Time logs";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("25.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "clock-o";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = "160px,160px,80px,auto";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << log_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                        listField.EntityName = "wv_timelog";
                        listField.FieldId = new Guid("29a32ad7-7b1c-4ea0-a06b-57b30be9b107");
                        listField.FieldName = "log_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = "username";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("393d1da8-0051-4807-8e89-1de933850888");
                        listItemFromRelation.RelationName = "user_wv_timelog_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << hours >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                        listField.EntityName = "wv_timelog";
                        listField.FieldId = new Guid("41caeb03-7430-4eb8-b830-c9df8bf2dc7f");
                        listField.FieldName = "hours";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << description >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                        listField.EntityName = "wv_timelog";
                        listField.FieldId = new Guid("1a1b646e-93df-4035-ace0-d844f62bad63");
                        listField.FieldName = "description";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "log_date";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Updated list: bug_timelogs Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_timelog name: task_timelogs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("e2db7515-721f-446e-8333-6149b1ba131b")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "task_timelogs").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "task_timelogs";
                createListInput.Label = "Time logs";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("25.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "clock-o";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = "160px,160px,80px,auto";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-href=""{{ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << log_date >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                        listField.EntityName = "wv_timelog";
                        listField.FieldId = new Guid("29a32ad7-7b1c-4ea0-a06b-57b30be9b107");
                        listField.FieldName = "log_date";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = "username";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("393d1da8-0051-4807-8e89-1de933850888");
                        listItemFromRelation.RelationName = "user_wv_timelog_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << hours >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                        listField.EntityName = "wv_timelog";
                        listField.FieldId = new Guid("41caeb03-7430-4eb8-b830-c9df8bf2dc7f");
                        listField.FieldName = "hours";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << description >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("e2db7515-721f-446e-8333-6149b1ba131b");
                        listField.EntityName = "wv_timelog";
                        listField.FieldId = new Guid("1a1b646e-93df-4035-ace0-d844f62bad63");
                        listField.FieldName = "description";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "log_date";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("e2db7515-721f-446e-8333-6149b1ba131b"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_timelog Updated list: task_timelogs Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_bug name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("a9951a8e-bb85-4581-85ea-1364a4d6ad66");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_bug name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("9565f541-177e-469e-a3ca-d14d096520f3");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug View: create >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("6781b136-b982-4934-a98c-5f736bd1a771");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("c0e3757b-6817-4eda-8cd1-e95b603af049");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("12");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("d94f100c-024c-47e7-af32-d67a49be2b6c");
                                    viewItemFromRelation.RelationName = "project_1_n_bug";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("4afe9621-39ee-40b9-a3ef-cb9b98131a6a");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        #region << Row 2>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("61b3052c-339d-4ad2-8a5f-59f215f07358");
                            viewRow.Weight = Decimal.Parse("2.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("6");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug View: general >>
            {
                var updateViewEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "general").Id;
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "Details";
                createViewInput.Title = "[{code}] {subject}";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "bug";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = "";
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    #region << Section: details >>
                    {
                        var viewSection = new InputRecordViewSection();
                        viewSection.Id = new Guid("b3679dee-d30d-46d7-b5ac-300ed8f1e922");
                        viewSection.Name = "details";
                        viewSection.Label = "Details";
                        viewSection.ShowLabel = false;
                        viewSection.CssClass = "";
                        viewSection.Collapsed = false;
                        viewSection.TabOrder = "left-right";
                        viewSection.Weight = Decimal.Parse("1.0");
                        viewSection.Rows = new List<InputRecordViewRow>();

                        #region << Row 1>>
                        {
                            var viewRow = new InputRecordViewRow();
                            viewRow.Id = new Guid("f9099d26-96ad-4fe2-9c81-db7a8f5daa47");
                            viewRow.Weight = Decimal.Parse("1.0");
                            viewRow.Columns = new List<InputRecordViewColumn>();

                            #region << Column 1 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("8");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << subject >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                                    viewItem.FieldName = "subject";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: name >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                                    viewItemFromRelation.EntityName = "wv_project";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                                    viewItemFromRelation.FieldName = "name";
                                    viewItemFromRelation.FieldLabel = "Project";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("d94f100c-024c-47e7-af32-d67a49be2b6c");
                                    viewItemFromRelation.RelationName = "project_1_n_bug";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << description >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("4afe9621-39ee-40b9-a3ef-cb9b98131a6a");
                                    viewItem.FieldName = "description";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            #region << Column 2 >>
                            {
                                var viewColumn = new InputRecordViewColumn();
                                viewColumn.GridColCount = Int32.Parse("4");
                                viewColumn.Items = new List<InputRecordViewItemBase>();

                                #region << code >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
                                    viewItem.FieldName = "code";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << status >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                                    viewItem.FieldName = "status";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << priority >>
                                {
                                    var viewItem = new InputRecordViewFieldItem();
                                    viewItem.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                                    viewItem.EntityName = "wv_bug";
                                    viewItem.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                                    viewItem.FieldName = "priority";
                                    viewItem.Type = "field";
                                    viewColumn.Items.Add(viewItem);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Owner";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                                    viewItemFromRelation.RelationName = "user_1_n_bug_owner";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                #region << field from Relation: username >>
                                {
                                    var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                                    viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                                    viewItemFromRelation.EntityName = "user";
                                    viewItemFromRelation.Type = "fieldFromRelation";
                                    viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                                    viewItemFromRelation.FieldName = "username";
                                    viewItemFromRelation.FieldLabel = "Watchers";
                                    viewItemFromRelation.FieldPlaceholder = "";
                                    viewItemFromRelation.FieldHelpText = null;
                                    viewItemFromRelation.FieldRequired = true;
                                    viewItemFromRelation.FieldLookupList = "lookup";
                                    viewItemFromRelation.RelationId = new Guid("b71d0c52-1626-48da-91bc-e10999ba79b8");
                                    viewItemFromRelation.RelationName = "user_n_n_bug_watchers";
                                    viewColumn.Items.Add(viewItemFromRelation);
                                }
                                #endregion
                                //Save column
                                viewRow.Columns.Add(viewColumn);
                            }
                            #endregion
                            //Save row
                            viewSection.Rows.Add(viewRow);
                        }
                        #endregion
                        //Save section
                        viewRegion.Sections.Add(viewSection);
                    }
                    #endregion
                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #region << list from relation: bug_attachments >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("2b83e4e3-6878-4b5b-9391-6e59429c0b5e");
                    viewItemFromRelation.ListName = "bug_attachments";
                    viewItemFromRelation.FieldLabel = "Attachments";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("a4f60f87-66a9-4541-a2ef-29e00f2b418b");
                    viewItemFromRelation.RelationName = "bug_1_n_attachment";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: bug_comments >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("b143b82f-b79f-47c1-87e7-ecba6f6f2a32");
                    viewItemFromRelation.ListName = "bug_comments";
                    viewItemFromRelation.FieldLabel = "Comments";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("5af026bd-d046-42ba-b6a0-e9090727348f");
                    viewItemFromRelation.RelationName = "bug_1_n_comment";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: bug_timelogs >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("f9a12626-08db-4fd2-a443-b521162be2b5");
                    viewItemFromRelation.ListName = "bug_timelogs";
                    viewItemFromRelation.FieldLabel = "Time logs";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("97909e49-50d4-4534-aa7b-61c523b55d87");
                    viewItemFromRelation.RelationName = "bug_1_n_time_log";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #region << list from relation: bug_activities >>
                {
                    var viewItemFromRelation = new InputRecordViewSidebarRelationListItem();
                    viewItemFromRelation.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                    viewItemFromRelation.EntityName = "wv_bug";
                    viewItemFromRelation.ListId = new Guid("57c3062c-df6e-488a-a432-dd927b0dd013");
                    viewItemFromRelation.ListName = "bug_activities";
                    viewItemFromRelation.FieldLabel = "Activities";
                    viewItemFromRelation.FieldPlaceholder = "";
                    viewItemFromRelation.FieldHelpText = "";
                    viewItemFromRelation.FieldRequired = false;
                    viewItemFromRelation.FieldManageView = "general";
                    viewItemFromRelation.FieldLookupList = "lookup";
                    viewItemFromRelation.RelationId = new Guid("b96189f7-a880-4da4-b9a9-2274a9745d2d");
                    viewItemFromRelation.RelationName = "bug_1_n_activity";
                    viewItemFromRelation.Type = "listFromRelation";
                    createViewInput.Sidebar.Items.Add(viewItemFromRelation);
                }
                #endregion

                #endregion
                {
                    var response = entMan.UpdateRecordView(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_bug name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("6e20244a-ee61-404c-af80-2cb2498b54bd");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug name: project_bugs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "project_bugs").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "project_bugs";
                createListInput.Label = "Bugs";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = "bug-list";
                createListInput.IconName = "bug";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = "auto,30px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listItemFromRelation.RelationName = "user_1_n_bug_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("781cee71-1632-4bf9-83b1-ff122d29eb2a");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")] = new InputRecordListQuery();
                        queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")].FieldName = "subject";
                        queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")].QueryType = "CONTAINS";
                        queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("71080102-9187-4a00-a7cf-f4c06358b37c"))) { queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")].SubQueries = subQueryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c"))) { subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")].Add(queryDictionary[new Guid("71080102-9187-4a00-a7cf-f4c06358b37c")]);
                    }
                    {
                        queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")] = new InputRecordListQuery();
                        queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")].FieldName = "status";
                        queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")].QueryType = "EQ";
                        queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695"))) { queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")].SubQueries = subQueryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c"))) { subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")].Add(queryDictionary[new Guid("bad7e9e9-5314-4c49-ab85-59123ea11695")]);
                    }
                    {
                        queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")] = new InputRecordListQuery();
                        queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")].FieldName = "priority";
                        queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                        queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")].QueryType = "EQ";
                        queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")].SubQueries = new List<InputRecordListQuery>();
                        if (subQueryDictionary.ContainsKey(new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae"))) { queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")].SubQueries = subQueryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c"))) { subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")].Add(queryDictionary[new Guid("66a31e85-464a-4bc5-8b5a-209945ce40ae")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("12f2b249-f609-4e21-a9da-d894f6cbe88c")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"created_on\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated list: project_bugs Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug name: created_bugs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "created_bugs").Id;
                createListInput.Type = "General";
                createListInput.Name = "created_bugs";
                createListInput.Label = "Bugs created by me";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("3.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "bug-list";
                createListInput.IconName = "bug";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listItemFromRelation.RelationName = "user_1_n_bug_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")] = new InputRecordListQuery();
                        queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")].FieldName = null;
                        queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")].FieldValue = null;
                        queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")].QueryType = "AND";
                        queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")] = new InputRecordListQuery();
                            queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")].FieldName = "created_by";
                            queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")].FieldValue = "{\"name\":\"current_user\", \"option\": \"id\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")].QueryType = "EQ";
                            queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf"))) { queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")].SubQueries = subQueryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807"))) { subQueryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")].Add(queryDictionary[new Guid("19f5bf29-fa48-4ec9-a04a-00c44b773caf")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807"))) { queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")].SubQueries = subQueryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83"))) { subQueryDictionary[new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83")].Add(queryDictionary[new Guid("2fedf88a-7309-4e97-a66b-c0682ba0b807")]);
                    }
                    {
                        queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")] = new InputRecordListQuery();
                        queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].FieldName = null;
                        queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].FieldValue = null;
                        queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].QueryType = "AND";
                        queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")] = new InputRecordListQuery();
                            queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")].FieldName = "code";
                            queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572"))) { queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")].SubQueries = subQueryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c"))) { subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].Add(queryDictionary[new Guid("05ad3e43-7d5f-49e2-8906-4d0dace4e572")]);
                        }
                        {
                            queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")] = new InputRecordListQuery();
                            queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")].FieldName = "subject";
                            queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0"))) { queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")].SubQueries = subQueryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c"))) { subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].Add(queryDictionary[new Guid("abea33cb-e34a-4dc0-8d48-a2fcdc35cff0")]);
                        }
                        {
                            queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")] = new InputRecordListQuery();
                            queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")].FieldName = "status";
                            queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")].QueryType = "EQ";
                            queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("0206e517-4e02-4a14-907d-3621a6ba013e"))) { queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")].SubQueries = subQueryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c"))) { subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].Add(queryDictionary[new Guid("0206e517-4e02-4a14-907d-3621a6ba013e")]);
                        }
                        {
                            queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")] = new InputRecordListQuery();
                            queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")].FieldName = "priority";
                            queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")].QueryType = "EQ";
                            queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a"))) { queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")].SubQueries = subQueryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c"))) { subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].Add(queryDictionary[new Guid("93efb4c4-ae57-4660-ae82-6fd7a42f974a")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c"))) { queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")].SubQueries = subQueryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83"))) { subQueryDictionary[new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83")].Add(queryDictionary[new Guid("9fe42513-4c88-4222-bfb0-437086df9e6c")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("a6643b4d-654d-4e40-9b46-c3c7700fdb83")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"created_on\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated list: created_bugs Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug name: owned_bugs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "owned_bugs").Id;
                createListInput.Type = "General";
                createListInput.Name = "owned_bugs";
                createListInput.Label = "Bugs owned by me";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("2.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "bug-list";
                createListInput.IconName = "bug";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listItemFromRelation.RelationName = "user_1_n_bug_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")] = new InputRecordListQuery();
                        queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")].FieldName = null;
                        queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")].FieldValue = null;
                        queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")].QueryType = "OR";
                        queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")] = new InputRecordListQuery();
                            queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")].FieldName = "owner_id";
                            queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")].FieldValue = "{\"name\":\"current_user\", \"option\": \"id\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")].QueryType = "EQ";
                            queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc"))) { queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")].SubQueries = subQueryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f"))) { subQueryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")].Add(queryDictionary[new Guid("dc4acb44-ebb0-481f-8b9e-2ba2cf97d9fc")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f"))) { queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")].SubQueries = subQueryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82"))) { subQueryDictionary[new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82")].Add(queryDictionary[new Guid("9b1812dd-1390-496f-8572-8d5470a6ef9f")]);
                    }
                    {
                        queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")] = new InputRecordListQuery();
                        queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].FieldName = null;
                        queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].FieldValue = null;
                        queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].QueryType = "AND";
                        queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")] = new InputRecordListQuery();
                            queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")].FieldName = "code";
                            queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("af42c498-f722-4568-8cef-a361c53dc950"))) { queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")].SubQueries = subQueryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937"))) { subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].Add(queryDictionary[new Guid("af42c498-f722-4568-8cef-a361c53dc950")]);
                        }
                        {
                            queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")] = new InputRecordListQuery();
                            queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")].FieldName = "subject";
                            queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5"))) { queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")].SubQueries = subQueryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937"))) { subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].Add(queryDictionary[new Guid("10bb07ab-ce08-41da-afb3-a33daa18c1d5")]);
                        }
                        {
                            queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")] = new InputRecordListQuery();
                            queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")].FieldName = "status";
                            queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")].FieldValue = "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")].QueryType = "EQ";
                            queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("083838f0-5418-4216-98c6-405c36a8914a"))) { queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")].SubQueries = subQueryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937"))) { subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].Add(queryDictionary[new Guid("083838f0-5418-4216-98c6-405c36a8914a")]);
                        }
                        {
                            queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")] = new InputRecordListQuery();
                            queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")].FieldName = "priority";
                            queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")].QueryType = "EQ";
                            queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6"))) { queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")].SubQueries = subQueryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937"))) { subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].Add(queryDictionary[new Guid("3abeac9b-6195-4c42-93ec-250036dd53a6")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937"))) { queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")].SubQueries = subQueryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82"))) { subQueryDictionary[new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82")].Add(queryDictionary[new Guid("d1199ab1-4fe9-4b3f-8e48-628ede3f5937")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("7935df8f-dea5-4f7c-b47b-1ca9145edd82")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"created_on\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated list: owned_bugs Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug name: all_bugs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "all_bugs").Id;
                createListInput.Type = "General";
                createListInput.Name = "all_bugs";
                createListInput.Label = "All Bugs";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("12.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "bug-list";
                createListInput.IconName = "bug";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = "/plugins/webvella-projects/api/bug/list/all";
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                                            <i class=""fa fa-fw fa-eye""></i>
                                            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listItemFromRelation.RelationName = "user_1_n_bug_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated list: all_bugs Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug name: admin >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "admin").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "admin";
                createListInput.Label = "All Bugs";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("3.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "bug-list";
                createListInput.IconName = "bug";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "auto,30px,120px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listItemFromRelation.RelationName = "user_1_n_bug_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("781cee71-1632-4bf9-83b1-ff122d29eb2a");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"created_on\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Descending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated list: admin Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_bug name: my_bugs >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "my_bugs").Id;
                createListInput.Type = "General";
                createListInput.Name = "my_bugs";
                createListInput.Label = "My Owned Open Bugs";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("1.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = "bug-list";
                createListInput.IconName = "bug";
                createListInput.VisibleColumnsCount = Int32.Parse("7");
                createListInput.ColumnWidthsCSV = "100px,auto,30px,160px,120px,120px,120px";
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                    <i class=""fa fa-fw fa-eye""></i>
                    </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << code >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
                        listField.FieldName = "code";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << subject >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
                        listField.FieldName = "subject";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = "Owner";
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
                        listItemFromRelation.RelationName = "user_1_n_bug_owner";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("781cee71-1632-4bf9-83b1-ff122d29eb2a");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << status >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
                        listField.FieldName = "status";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << priority >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
                        listField.EntityName = "wv_bug";
                        listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
                        listField.FieldName = "priority";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = new InputRecordListQuery();
                    var queryDictionary = new Dictionary<Guid, InputRecordListQuery>();
                    var subQueryDictionary = new Dictionary<Guid, List<InputRecordListQuery>>();
                    //Main query rule
                    createListInput.Query.FieldName = null;
                    createListInput.Query.FieldValue = null;
                    createListInput.Query.QueryType = "AND";
                    createListInput.Query.SubQueries = new List<InputRecordListQuery>();
                    {
                        queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")] = new InputRecordListQuery();
                        queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")].FieldName = null;
                        queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")].FieldValue = null;
                        queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")].QueryType = "AND";
                        queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")] = new InputRecordListQuery();
                            queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")].FieldName = "owner_id";
                            queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")].FieldValue = "{\"name\":\"current_user\", \"option\": \"id\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")].QueryType = "EQ";
                            queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2"))) { queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")].SubQueries = subQueryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf"))) { subQueryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")].Add(queryDictionary[new Guid("de3253ce-9f62-4014-9c12-b22dac0344c2")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf"))) { queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")].SubQueries = subQueryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a"))) { subQueryDictionary[new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a")].Add(queryDictionary[new Guid("fcb8b25e-81d1-4b22-89bf-e67d4000d1bf")]);
                    }
                    {
                        queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")] = new InputRecordListQuery();
                        queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].FieldName = null;
                        queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].FieldValue = null;
                        queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].QueryType = "AND";
                        queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].SubQueries = new List<InputRecordListQuery>();
                        {
                            queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")] = new InputRecordListQuery();
                            queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")].FieldName = "code";
                            queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")].FieldValue = "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653"))) { queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")].SubQueries = subQueryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("b5c48786-0d53-4b3a-b136-421e6927973f"))) { subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].Add(queryDictionary[new Guid("b037a01d-93b7-4a7e-bf17-12701a0bd653")]);
                        }
                        {
                            queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")] = new InputRecordListQuery();
                            queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")].FieldName = "subject";
                            queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")].FieldValue = "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")].QueryType = "CONTAINS";
                            queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f"))) { queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")].SubQueries = subQueryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("b5c48786-0d53-4b3a-b136-421e6927973f"))) { subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].Add(queryDictionary[new Guid("53094889-679d-4bd0-b391-e59bc90f5a2f")]);
                        }
                        {
                            queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")] = new InputRecordListQuery();
                            queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")].FieldName = "status";
                            queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")].FieldValue = "closed";
                            queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")].QueryType = "NOT";
                            queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("012845b5-27ee-4407-ad07-0531d681dd07"))) { queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")].SubQueries = subQueryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("b5c48786-0d53-4b3a-b136-421e6927973f"))) { subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].Add(queryDictionary[new Guid("012845b5-27ee-4407-ad07-0531d681dd07")]);
                        }
                        {
                            queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")] = new InputRecordListQuery();
                            queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")].FieldName = "priority";
                            queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")].FieldValue = "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
                            queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")].QueryType = "EQ";
                            queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")].SubQueries = new List<InputRecordListQuery>();
                            if (subQueryDictionary.ContainsKey(new Guid("c332e15f-c5c3-4863-9925-12758f917b77"))) { queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")].SubQueries = subQueryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")]; }
                            if (!subQueryDictionary.ContainsKey(new Guid("b5c48786-0d53-4b3a-b136-421e6927973f"))) { subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")] = new List<InputRecordListQuery>(); }
                            subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].Add(queryDictionary[new Guid("c332e15f-c5c3-4863-9925-12758f917b77")]);
                        }
                        if (subQueryDictionary.ContainsKey(new Guid("b5c48786-0d53-4b3a-b136-421e6927973f"))) { queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")].SubQueries = subQueryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")]; }
                        if (!subQueryDictionary.ContainsKey(new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a"))) { subQueryDictionary[new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a")] = new List<InputRecordListQuery>(); }
                        subQueryDictionary[new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a")].Add(queryDictionary[new Guid("b5c48786-0d53-4b3a-b136-421e6927973f")]);
                    }
                    if (subQueryDictionary.ContainsKey(new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a"))) { createListInput.Query.SubQueries = subQueryDictionary[new Guid("345848cd-2987-4d01-ae68-9e1d19544c6a")]; }
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"created_on\", \"settings\":{\"order\":\"sortOrder\"}}";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_bug Updated list: my_bugs Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: plugin_data name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("2a384965-60ec-4856-ae8c-a0396ea646ae");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: plugin_data Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: plugin_data name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("30921924-a411-4235-8d5a-0380a9c33a21");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: plugin_data Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: plugin_data name: create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("a9905dc8-9a3d-4f58-8d4f-597b6e9cec0c");
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "Create";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: plugin_data Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: plugin_data name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("253faf72-58ea-4152-9b22-3e29814a400b");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "General";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: plugin_data Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: plugin_data name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("7fa5aafd-b093-4088-abe0-ba2147772a36");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: plugin_data Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: plugin_data name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("b3001a35-6037-4491-b2b0-1340e05ff57f");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("d928d031-c8b1-4359-be3e-39bceb58f268"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: plugin_data Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_comment name: create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("c02e83e9-f601-489a-8d72-e8e66a47dfa8");
                createViewInput.Type = "Create";
                createViewInput.Name = "create";
                createViewInput.Label = "Create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated view: create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_comment name: quick_create >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("eea2f8c7-0dd1-41c1-8924-9b37e1abb9a9");
                createViewInput.Type = "Quick_Create";
                createViewInput.Name = "quick_create";
                createViewInput.Label = "Quick create";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_list >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_list";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_and_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_and_details";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("2.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""::ngCtrl.createViewRegion != null"">Create & Details</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_create_cancel >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_cancel";
                        actionItem.Menu = "create-bottom";
                        actionItem.Weight = Decimal.Parse("3.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated view: quick_create Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_comment name: quick_view >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("28e7ff58-b08f-4e36-88af-4f83da309d75");
                createViewInput.Type = "Quick_View";
                createViewInput.Name = "quick_view";
                createViewInput.Label = "Quick view";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated view: quick_view Message:" + response.Message);
                }
            }
            #endregion

            #region << View  Enity: wv_project_comment name: general >>
            {
                var createViewEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createViewInput = new InputRecordView();

                #region << details >>
                createViewInput.Id = new Guid("769b359c-9444-4ca7-aa02-cfb80835492a");
                createViewInput.Type = "General";
                createViewInput.Name = "general";
                createViewInput.Label = "General";
                createViewInput.Title = "";
                createViewInput.Default = true;
                createViewInput.System = false;
                createViewInput.Weight = Decimal.Parse("10.0");
                createViewInput.CssClass = "";
                createViewInput.IconName = "file-text-o";
                createViewInput.DynamicHtmlTemplate = null;
                createViewInput.DataSourceUrl = null;
                createViewInput.ServiceCode = null;
                #endregion

                #region << regions >>
                createViewInput.Regions = new List<InputRecordViewRegion>();

                #region << Region: header >>
                {
                    var viewRegion = new InputRecordViewRegion();
                    viewRegion.Name = "header";
                    viewRegion.Label = "Header";
                    viewRegion.Render = true;
                    viewRegion.Weight = Decimal.Parse("10.0");
                    viewRegion.CssClass = "";
                    viewRegion.Sections = new List<InputRecordViewSection>();

                    //Save region
                    createViewInput.Regions.Add(viewRegion);
                }
                #endregion

                #endregion

                #region << Relation options >>
                {
                    createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createViewInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_record_delete >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_delete";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""::ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
            ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
            <i class=""fa fa-trash go-red""></i> Delete Record
            </a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_back_button >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_back_button";
                        actionItem.Menu = "sidebar-top";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
                        createViewInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Sidebar >>
                createViewInput.Sidebar = new InputRecordViewSidebar();
                createViewInput.Sidebar.CssClass = "";
                createViewInput.Sidebar.Render = false;
                createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

                #endregion
                {
                    var response = entMan.CreateRecordView(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createViewInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated view: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_project_comment name: general >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("5e1c1cef-5832-4a10-b986-2bb5c06ccc79");
                createListInput.Type = "General";
                createListInput.Name = "general";
                createListInput.Label = "General";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Created list: general Message:" + response.Message);
                }
            }
            #endregion

            #region << List  Enity: wv_project_comment name: lookup >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = new Guid("9916b331-3f45-485a-b431-23558e96175d");
                createListInput.Type = "Lookup";
                createListInput.Name = "lookup";
                createListInput.Label = "Lookup";
                createListInput.Title = null;
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = true;
                createListInput.System = false;
                createListInput.CssClass = null;
                createListInput.IconName = string.IsNullOrEmpty("list") ? string.Empty : "list";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("10");
                createListInput.DynamicHtmlTemplate = null;
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = null;
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl()}}"">Add New</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_import_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_import_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("10.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openImportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-upload""></i> Import CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_export_records >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_export_records";
                        actionItem.Menu = "page-title-dropdown";
                        actionItem.Weight = Decimal.Parse("11.0");
                        actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                    #region << action item: wv_record_details >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_record_details";
                        actionItem.Menu = "record-row";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record)}}"">
            <i class=""fa fa-fw fa-eye""></i>
            </a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                }
                #endregion

                {
                    var response = entMan.CreateRecordList(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Created list: lookup Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project_comment name: task_comments >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "task_comments").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "task_comments";
                createListInput.Label = "Comments";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "comments-o";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("0");
                createListInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/task-comments.html";
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = "/plugins/webvella-projects/providers/task-comments.service.js";
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-click=""ngCtrl.actionService.manageComment(null,ngCtrl)"">Add Comment</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("c205c60f-598a-4db7-bd41-a7fd2ae3abd0");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                        listItemFromRelation.RelationName = "user_wv_project_comment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << content >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("23afb07b-438f-4e31-9372-c850a5789cc6");
                        listField.FieldName = "content";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                        listItemFromRelation.RelationName = "user_wv_project_comment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_by >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("46208807-7bc8-4f54-8618-45134189e763");
                        listField.FieldName = "created_by";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "created_on";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated list: task_comments Message:" + response.Message);
                }
            }
            #endregion

            #region << Update  Enity: wv_project_comment name: bug_comments >>
            {
                var createListEntity = entMan.ReadEntity(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99")).Object;
                var createListInput = new InputRecordList();

                #region << details >>
                createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "bug_comments").Id;
                createListInput.Type = "Hidden";
                createListInput.Name = "bug_comments";
                createListInput.Label = "Comments";
                createListInput.Title = "";
                createListInput.Weight = Decimal.Parse("10.0");
                createListInput.Default = false;
                createListInput.System = true;
                createListInput.CssClass = null;
                createListInput.IconName = "comments-o";
                createListInput.VisibleColumnsCount = Int32.Parse("5");
                createListInput.ColumnWidthsCSV = null;
                createListInput.PageSize = Int32.Parse("0");
                createListInput.DynamicHtmlTemplate = "/plugins/webvella-projects/templates/bug-comments.html";
                createListInput.DataSourceUrl = null;
                createListInput.ServiceCode = "/plugins/webvella-projects/providers/bug-comments.service.js";
                #endregion

                #region << Relation options >>
                {
                    createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
                }
                #endregion

                #region << Action items >>
                {
                    createListInput.ActionItems = new List<ActionItem>();

                    #region << action item: wv_create_record >>
                    {
                        var actionItem = new ActionItem();
                        actionItem.Name = "wv_create_record";
                        actionItem.Menu = "page-title";
                        actionItem.Weight = Decimal.Parse("1.0");
                        actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                            ng-click=""ngCtrl.actionService.manageComment(null,ngCtrl)"">Add Comment</a>";
                        createListInput.ActionItems.Add(actionItem);
                    }
                    #endregion

                }
                #endregion

                #region << Columns >>
                {
                    createListInput.Columns = new List<InputRecordListItemBase>();

                    #region << created_on >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("c205c60f-598a-4db7-bd41-a7fd2ae3abd0");
                        listField.FieldName = "created_on";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: username >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        listItemFromRelation.FieldName = "username";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                        listItemFromRelation.RelationName = "user_wv_project_comment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << content >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("23afb07b-438f-4e31-9372-c850a5789cc6");
                        listField.FieldName = "content";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                    #region << field from Relation: image >>
                    {
                        var listItemFromRelation = new InputRecordListRelationFieldItem();
                        listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        listItemFromRelation.EntityName = "user";
                        listItemFromRelation.Type = "fieldFromRelation";
                        listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        listItemFromRelation.FieldName = "image";
                        listItemFromRelation.FieldLabel = null;
                        listItemFromRelation.FieldPlaceholder = null;
                        listItemFromRelation.FieldHelpText = null;
                        listItemFromRelation.FieldRequired = false;
                        listItemFromRelation.FieldLookupList = null;
                        listItemFromRelation.RelationId = new Guid("2f3635a3-298e-475e-90f4-7d512da6cf95");
                        listItemFromRelation.RelationName = "user_wv_project_comment_created_by";
                        createListInput.Columns.Add(listItemFromRelation);
                    }
                    #endregion
                    #region << created_by >>
                    {
                        var listField = new InputRecordListFieldItem();
                        listField.EntityId = new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99");
                        listField.EntityName = "wv_project_comment";
                        listField.FieldId = new Guid("46208807-7bc8-4f54-8618-45134189e763");
                        listField.FieldName = "created_by";
                        listField.Type = "field";
                        createListInput.Columns.Add(listField);
                    }
                    #endregion
                }
                #endregion

                #region << Query >>
                {
                    createListInput.Query = null;
                }
                #endregion

                #region << Sorts >>
                {
                    createListInput.Sorts = new List<InputRecordListSort>();

                    #region << sort >>
                    {
                        var sort = new InputRecordListSort();
                        sort.FieldName = "created_on";
                        sort.SortType = "Ascending";
                        createListInput.Sorts.Add(sort);
                    }
                    #endregion

                }
                #endregion

                {
                    var response = entMan.UpdateRecordList(new Guid("7a57d17e-98f0-4356-baf0-9a8798da0b99"), createListInput);
                    if (!response.Success)
                        throw new Exception("System error 10060. Entity: wv_project_comment Updated list: bug_comments Message:" + response.Message);
                }
            }
            #endregion
        }
Beispiel #19
0
        private static void Patch160707(EntityManager entMan, EntityRelationManager relMan, RecordManager recMan, bool createSampleRecords = false)
        {
            #region << Create relation: role_n_n_wv_sprint >>
            {
            var relation = new EntityRelation();
            var originEntity = entMan.ReadEntity(new Guid("c4541fee-fbb6-4661-929e-1724adec285a")).Object;
            var originField = originEntity.Fields.SingleOrDefault(x => x.Name == "id");
            var targetEntity = entMan.ReadEntity(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd")).Object;
            var targetField = targetEntity.Fields.SingleOrDefault(x => x.Name == "id");
            relation.Id = new Guid("e77b7a71-134e-41bf-a079-008e8931303f");
            relation.Name =  "role_n_n_wv_sprint";
            relation.Label = "role_n_n_wv_sprint";
            relation.Description = "";
            relation.System =  true;
            relation.RelationType = EntityRelationType.ManyToMany;
            relation.OriginEntityId = originEntity.Id;
            relation.OriginEntityName = originEntity.Name;
            relation.OriginFieldId = originField.Id;
            relation.OriginFieldName = originField.Name;
            relation.TargetEntityId = targetEntity.Id;
            relation.TargetEntityName = targetEntity.Name;
            relation.TargetFieldId = targetField.Id;
            relation.TargetFieldName = targetField.Name;
            {
            var response = relMan.Create(relation);
            if (!response.Success)
            throw new Exception("System error 10060. Relation: role_n_n_wv_sprint Create. Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_project View: admin_create >>
            {
            var updateViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
            var createViewInput = new InputRecordView();

            #region << details >>
            createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "admin_create").Id;
            createViewInput.Type = "Hidden";
            createViewInput.Name = "admin_create";
            createViewInput.Label = "Project create";
            createViewInput.Title = "";
            createViewInput.Default = false;
            createViewInput.System = true;
            createViewInput.Weight = Decimal.Parse("10.0");
            createViewInput.CssClass = null;
            createViewInput.IconName = "product-hunt";
            createViewInput.DynamicHtmlTemplate = null;
            createViewInput.DataSourceUrl = null;
            createViewInput.ServiceCode = null;
            #endregion

            #region << regions >>
            createViewInput.Regions = new List<InputRecordViewRegion>();

            #region << Region: header >>
            {
            var viewRegion = new InputRecordViewRegion();
            viewRegion.Name = "header";
            viewRegion.Label = "Header";
            viewRegion.Render = true;
            viewRegion.Weight = Decimal.Parse("1.0");
            viewRegion.CssClass = "";
            viewRegion.Sections = new List<InputRecordViewSection>();

            #region << Section: details >>
            {
            var viewSection = new InputRecordViewSection();
            viewSection.Id = new Guid("88077697-7a36-4a5a-b021-3d2a8638dade");
            viewSection.Name = "details";
            viewSection.Label = "Details";
            viewSection.ShowLabel = false;
            viewSection.CssClass = "";
            viewSection.Collapsed = false;
            viewSection.TabOrder = "left-right";
            viewSection.Weight = Decimal.Parse("1.0");
            viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row 1>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("27fb37e4-774a-4b07-a678-a435dcd6be55");
                    viewRow.Weight = Decimal.Parse("1.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("4");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << code >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("d9c6a939-e2e3-4617-900e-e056f0638fa8");
                        viewItem.FieldName = "code";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                    #region << Column 2 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("8");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
                #region << Row 2>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("cc65d58f-0cfd-4f3d-b9c6-3c8faff6c8b4");
                    viewRow.Weight = Decimal.Parse("2.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("12");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << description >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("d5e2c42c-c0b8-4f03-92e0-e91bede1e7b3");
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
                #region << Row 3>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("d88b3da7-d501-48ba-b61d-2eb3485bce21");
                    viewRow.Weight = Decimal.Parse("3.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << field from Relation: username >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        viewItemFromRelation.EntityName = "user";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        viewItemFromRelation.FieldName = "username";
                        viewItemFromRelation.FieldLabel = "Owner / Project manager";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("0cad07c3-73bd-4c1f-a5d6-552256f679a4");
                        viewItemFromRelation.RelationName = "user_1_n_project_owner";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        viewItemFromRelation.EntityName = "role";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project team roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("4860a4b6-d07e-416f-b548-60491607e93f");
                        viewItemFromRelation.RelationName = "role_n_n_project_team";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("417ce7d7-a472-499b-8e70-43a1cb54723d");
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    #region << billable_hour_price >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("7179f4ab-0376-4ded-a334-a21ff451538e");
                        viewItem.FieldName = "billable_hour_price";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                    #region << Column 2 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("90bcdb47-2cde-4137-a412-0198348fecc0");
                        viewItemFromRelation.EntityName = "wv_customer";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Customer";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("d7f1ec35-9f59-4d75-b8a2-554c7eaeab11");
                        viewItemFromRelation.RelationName = "customer_1_n_project";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        viewItemFromRelation.EntityName = "role";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project customer roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("e6d75feb-3c8f-410b-9ff4-54ef8489dc2f");
                        viewItemFromRelation.RelationName = "role_n_n_project_customer";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("57198778-636d-47ec-b33e-edfc5705cc05");
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
            //Save section
            viewRegion.Sections.Add(viewSection);
            }
            #endregion
            //Save region
            createViewInput.Regions.Add(viewRegion);
            }
            #endregion

            #endregion

            #region << Relation options >>
            {
            createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
            }
            #endregion

            #region << Action items >>
            {
            createViewInput.ActionItems = new List<ActionItem>();

            #region << action item: wv_create_and_list >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_and_list";
            actionItem.Menu = "create-bottom";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""ngCtrl.createViewRegion != null"">Create</a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_create_and_details >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_and_details";
            actionItem.Menu = "create-bottom";
            actionItem.Weight = Decimal.Parse("2.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click='ngCtrl.create(""details"")' ng-if=""ngCtrl.createViewRegion != null"">Create & Details</a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_create_cancel >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_cancel";
            actionItem.Menu = "create-bottom";
            actionItem.Weight = Decimal.Parse("3.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_back_button >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_back_button";
            actionItem.Menu = "sidebar-top";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            }
            #endregion

            #region << Sidebar >>
            createViewInput.Sidebar = new InputRecordViewSidebar();
            createViewInput.Sidebar.CssClass = "";
            createViewInput.Sidebar.Render = true;
            createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

            #endregion
            {
            var response = entMan.UpdateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_project Updated view: admin_create Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_project View: admin_details >>
            {
            var updateViewEntity = entMan.ReadEntity(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32")).Object;
            var createViewInput = new InputRecordView();

            #region << details >>
            createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "admin_details").Id;
            createViewInput.Type = "Hidden";
            createViewInput.Name = "admin_details";
            createViewInput.Label = "Project details";
            createViewInput.Title = "";
            createViewInput.Default = false;
            createViewInput.System = true;
            createViewInput.Weight = Decimal.Parse("10.0");
            createViewInput.CssClass = null;
            createViewInput.IconName = "product-hunt";
            createViewInput.DynamicHtmlTemplate = null;
            createViewInput.DataSourceUrl = null;
            createViewInput.ServiceCode = null;
            #endregion

            #region << regions >>
            createViewInput.Regions = new List<InputRecordViewRegion>();

            #region << Region: header >>
            {
            var viewRegion = new InputRecordViewRegion();
            viewRegion.Name = "header";
            viewRegion.Label = "Header";
            viewRegion.Render = true;
            viewRegion.Weight = Decimal.Parse("1.0");
            viewRegion.CssClass = "";
            viewRegion.Sections = new List<InputRecordViewSection>();

            #region << Section: details >>
            {
            var viewSection = new InputRecordViewSection();
            viewSection.Id = new Guid("6f8fdcc2-8a8f-4cf6-bf26-47bf1c6f0438");
            viewSection.Name = "details";
            viewSection.Label = "Details";
            viewSection.ShowLabel = false;
            viewSection.CssClass = "";
            viewSection.Collapsed = false;
            viewSection.TabOrder = "left-right";
            viewSection.Weight = Decimal.Parse("1.0");
            viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row 1>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("ca9aedde-ce06-4c57-8942-8a346d594535");
                    viewRow.Weight = Decimal.Parse("1.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("4");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << code >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("d9c6a939-e2e3-4617-900e-e056f0638fa8");
                        viewItem.FieldName = "code";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                    #region << Column 2 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("8");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("d13427b7-e518-4305-b2cc-bc814a299b55");
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
                #region << Row 2>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("5d7ce054-f592-41e7-b8f1-424cfd6d38b7");
                    viewRow.Weight = Decimal.Parse("2.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("12");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << description >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("d5e2c42c-c0b8-4f03-92e0-e91bede1e7b3");
                        viewItem.FieldName = "description";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
                #region << Row 3>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("22d11cfc-a763-472b-b509-7ddfe36476bb");
                    viewRow.Weight = Decimal.Parse("3.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << field from Relation: username >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
                        viewItemFromRelation.EntityName = "user";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                        viewItemFromRelation.FieldName = "username";
                        viewItemFromRelation.FieldLabel = "Owner / Project manager";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("0cad07c3-73bd-4c1f-a5d6-552256f679a4");
                        viewItemFromRelation.RelationName = "user_1_n_project_owner";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        viewItemFromRelation.EntityName = "role";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project team roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("4860a4b6-d07e-416f-b548-60491607e93f");
                        viewItemFromRelation.RelationName = "role_n_n_project_team";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << start_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("417ce7d7-a472-499b-8e70-43a1cb54723d");
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    #region << billable_hour_price >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("7179f4ab-0376-4ded-a334-a21ff451538e");
                        viewItem.FieldName = "billable_hour_price";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                    #region << Column 2 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("90bcdb47-2cde-4137-a412-0198348fecc0");
                        viewItemFromRelation.EntityName = "wv_customer";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Customer";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("d7f1ec35-9f59-4d75-b8a2-554c7eaeab11");
                        viewItemFromRelation.RelationName = "customer_1_n_project";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        viewItemFromRelation.EntityName = "role";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Project customer roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = null;
                        viewItemFromRelation.FieldRequired = true;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("e6d75feb-3c8f-410b-9ff4-54ef8489dc2f");
                        viewItemFromRelation.RelationName = "role_n_n_project_customer";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    #region << end_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32");
                        viewItem.EntityName = "wv_project";
                        viewItem.FieldId = new Guid("57198778-636d-47ec-b33e-edfc5705cc05");
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
            //Save section
            viewRegion.Sections.Add(viewSection);
            }
            #endregion
            //Save region
            createViewInput.Regions.Add(viewRegion);
            }
            #endregion

            #endregion

            #region << Relation options >>
            {
            createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
            }
            #endregion

            #region << Action items >>
            {
            createViewInput.ActionItems = new List<ActionItem>();

            #region << action item: wv_record_delete >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_record_delete";
            actionItem.Menu = "page-title-dropdown";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""Are you sure?""
                                        ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
                                    <i class=""fa fa-trash go-red""></i> Delete Record
                                </a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_back_button >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_back_button";
            actionItem.Menu = "sidebar-top";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            }
            #endregion

            #region << Sidebar >>
            createViewInput.Sidebar = new InputRecordViewSidebar();
            createViewInput.Sidebar.CssClass = "";
            createViewInput.Sidebar.Render = true;
            createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

            #endregion
            {
            var response = entMan.UpdateRecordView(new Guid("7821ece9-42ce-470b-84d4-afc9eb35aa32"), createViewInput);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_project Updated view: admin_details Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_bug name: all_bugs >>
            {
            var createListEntity = entMan.ReadEntity(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c")).Object;
            var createListInput = new InputRecordList();

            #region << details >>
            createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "all_bugs").Id;
            createListInput.Type =  "General";
            createListInput.Name = "all_bugs";
            createListInput.Label = "All Bugs";
            createListInput.Title = "";
            createListInput.Weight = Decimal.Parse("12.0");
            createListInput.Default = false;
            createListInput.System = true;
            createListInput.CssClass = "bug-list";
            createListInput.IconName = "bug";
            createListInput.VisibleColumnsCount = Int32.Parse("7");
            createListInput.ColumnWidthsCSV = "100px,auto,30px,120px,120px,120px,120px";
            createListInput.PageSize = Int32.Parse("10");
            createListInput.DynamicHtmlTemplate = null;
            createListInput.DataSourceUrl = "/plugins/webvella-projects/api/bug/list/all";
            createListInput.ServiceCode = null;
            #endregion

            #region << Relation options >>
            {
            createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
            }
            #endregion

            #region << Action items >>
            {
            createListInput.ActionItems = new List<ActionItem>();

            #region << action item: wv_record_details >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_record_details";
            actionItem.Menu = "record-row";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                                            <i class=""fa fa-fw fa-eye""></i>
                                            </a>";
            createListInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_create_record >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_record";
            actionItem.Menu = "page-title";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
                                    ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
            createListInput.ActionItems.Add(actionItem);
            }
            #endregion

            }
            #endregion

            #region << Columns >>
            {
            createListInput.Columns = new List<InputRecordListItemBase>();

            #region << code >>
            {
            var listField = new InputRecordListFieldItem();
            listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
            listField.EntityName = "wv_bug";
            listField.FieldId = new Guid("6f2030e9-edd7-42ac-bb2a-2766b76c3da1");
            listField.FieldName = "code";
            listField.Type = "field";
            createListInput.Columns.Add(listField);
            }
            #endregion
            #region << subject >>
            {
            var listField = new InputRecordListFieldItem();
            listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
            listField.EntityName = "wv_bug";
            listField.FieldId = new Guid("335a4500-130e-4739-b774-2f53f33ea22a");
            listField.FieldName = "subject";
            listField.Type = "field";
            createListInput.Columns.Add(listField);
            }
            #endregion
            #region << field from Relation: image >>
            {
            var listItemFromRelation = new InputRecordListRelationFieldItem();
            listItemFromRelation.EntityId = new Guid("b9cebc3b-6443-452a-8e34-b311a73dcc8b");
            listItemFromRelation.EntityName = "user";
            listItemFromRelation.Type = "fieldFromRelation";
            listItemFromRelation.FieldId = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
            listItemFromRelation.FieldName = "image";
            listItemFromRelation.FieldLabel = "Owner";
            listItemFromRelation.FieldPlaceholder = null;
            listItemFromRelation.FieldHelpText = null;
            listItemFromRelation.FieldRequired = false;
            listItemFromRelation.FieldLookupList = null;
            listItemFromRelation.RelationId = new Guid("cddc10b6-30ff-4a86-96e4-645b3ea59fd9");
            listItemFromRelation.RelationName = "user_1_n_bug_owner";
            createListInput.Columns.Add(listItemFromRelation);
            }
            #endregion
            #region << status >>
            {
            var listField = new InputRecordListFieldItem();
            listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
            listField.EntityName = "wv_bug";
            listField.FieldId = new Guid("48be1e6e-df47-46f0-b4e1-6e9e1cbaf71c");
            listField.FieldName = "status";
            listField.Type = "field";
            createListInput.Columns.Add(listField);
            }
            #endregion
            #region << priority >>
            {
            var listField = new InputRecordListFieldItem();
            listField.EntityId = new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c");
            listField.EntityName = "wv_bug";
            listField.FieldId = new Guid("e506dfc7-6d49-4d00-9f61-8befd56c1a6e");
            listField.FieldName = "priority";
            listField.Type = "field";
            createListInput.Columns.Add(listField);
            }
            #endregion
            }
            #endregion

            #region << Query >>
            {
            createListInput.Query = new InputRecordListQuery();
            var queryDictionary = new Dictionary<Guid,InputRecordListQuery>();
            var subQueryDictionary = new Dictionary<Guid,List<InputRecordListQuery>>();
            //Main query rule
            createListInput.Query.FieldName = null;
            createListInput.Query.FieldValue =  null;
            createListInput.Query.QueryType = "AND";
            createListInput.Query.SubQueries = new List<InputRecordListQuery>();
            {
            queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")] = new InputRecordListQuery();
            queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")].FieldName = "code";
            queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")].FieldValue =  "{\"name\":\"url_query\", \"option\": \"code\", \"default\": null, \"settings\":{}}";
            queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")].QueryType = "CONTAINS";
            queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")].SubQueries = new List<InputRecordListQuery>();
            if(subQueryDictionary.ContainsKey(new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b"))) {queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")].SubQueries = subQueryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")];}
            if(!subQueryDictionary.ContainsKey(new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945"))) {subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")] = new List<InputRecordListQuery>();}
            subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")].Add(queryDictionary[new Guid("0137bb5c-b9e6-42eb-a3d3-4b954203205b")]);
            }
            {
            queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")] = new InputRecordListQuery();
            queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")].FieldName = "subject";
            queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")].FieldValue =  "{\"name\":\"url_query\", \"option\": \"subject\", \"default\": null, \"settings\":{}}";
            queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")].QueryType = "CONTAINS";
            queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")].SubQueries = new List<InputRecordListQuery>();
            if(subQueryDictionary.ContainsKey(new Guid("5172023d-a3cb-4945-af23-ff539f40b479"))) {queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")].SubQueries = subQueryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")];}
            if(!subQueryDictionary.ContainsKey(new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945"))) {subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")] = new List<InputRecordListQuery>();}
            subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")].Add(queryDictionary[new Guid("5172023d-a3cb-4945-af23-ff539f40b479")]);
            }
            {
            queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")] = new InputRecordListQuery();
            queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")].FieldName = "status";
            queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")].FieldValue =  "{\"name\":\"url_query\", \"option\": \"status\", \"default\": null, \"settings\":{}}";
            queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")].QueryType = "EQ";
            queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")].SubQueries = new List<InputRecordListQuery>();
            if(subQueryDictionary.ContainsKey(new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39"))) {queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")].SubQueries = subQueryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")];}
            if(!subQueryDictionary.ContainsKey(new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945"))) {subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")] = new List<InputRecordListQuery>();}
            subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")].Add(queryDictionary[new Guid("50fd915f-aadf-4f29-9e68-5c60b7ed2f39")]);
            }
            {
            queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")] = new InputRecordListQuery();
            queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")].FieldName = "priority";
            queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")].FieldValue =  "{\"name\":\"url_query\", \"option\": \"priority\", \"default\": null, \"settings\":{}}";
            queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")].QueryType = "EQ";
            queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")].SubQueries = new List<InputRecordListQuery>();
            if(subQueryDictionary.ContainsKey(new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e"))) {queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")].SubQueries = subQueryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")];}
            if(!subQueryDictionary.ContainsKey(new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945"))) {subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")] = new List<InputRecordListQuery>();}
            subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")].Add(queryDictionary[new Guid("98093a42-d6cb-48e1-a2d2-d93f1bb5591e")]);
            }
            if(subQueryDictionary.ContainsKey(new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945"))) {createListInput.Query.SubQueries = subQueryDictionary[new Guid("48180ab7-1e06-48e9-8aeb-7625e166a945")];}
            }
            #endregion

            #region << Sorts >>
            {
            createListInput.Sorts = new List<InputRecordListSort>();

            #region << sort >>
            {
            var sort = new InputRecordListSort();
            sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": \"end_date\", \"settings\":{\"order\":\"sortOrder\"}}";
            sort.SortType = "Ascending";
            createListInput.Sorts.Add(sort);
            }
            #endregion

            }
            #endregion

            {
            var response = entMan.UpdateRecordList(new Guid("c11655fa-e4a3-4c2b-8f1e-0a6d87cfd20c"), createListInput);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_bug Updated list: all_bugs Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_sprint field: start_date >>
            {
            var currentEntity = entMan.ReadEntity(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd")).Object;
            InputDateField dateField = new InputDateField();
            dateField.Id =  currentEntity.Fields.SingleOrDefault(x => x.Name == "start_date").Id;
            dateField.Name = "start_date";
            dateField.Label = "Start date";
            dateField.PlaceholderText = "";
            dateField.Description = "";
            dateField.HelpText = "";
            dateField.Required = true;
            dateField.Unique = false;
            dateField.Searchable = true;
            dateField.Auditable = false;
            dateField.System = true;
            dateField.DefaultValue = DateTime.Parse("11/30/2015 10:00:00 PM");
            dateField.Format = "yyyy-MMM-dd";
            dateField.UseCurrentTimeAsDefaultValue = false;
            dateField.EnableSecurity = false;
            dateField.Permissions = new FieldPermissions();
            dateField.Permissions.CanRead = new List<Guid>();
            dateField.Permissions.CanUpdate = new List<Guid>();
            //READ
            //UPDATE
            {
            var response = entMan.UpdateField(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd"), dateField);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_sprint Field: start_date Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_sprint View: general >>
            {
            var updateViewEntity = entMan.ReadEntity(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd")).Object;
            var createViewInput = new InputRecordView();

            #region << details >>
            createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "general").Id;
            createViewInput.Type = "General";
            createViewInput.Name = "general";
            createViewInput.Label = "General";
            createViewInput.Title = "{name}";
            createViewInput.Default = true;
            createViewInput.System = false;
            createViewInput.Weight = Decimal.Parse("10.0");
            createViewInput.CssClass = "";
            createViewInput.IconName = "file-text-o";
            createViewInput.DynamicHtmlTemplate = null;
            createViewInput.DataSourceUrl = null;
            createViewInput.ServiceCode = null;
            #endregion

            #region << regions >>
            createViewInput.Regions = new List<InputRecordViewRegion>();

            #region << Region: header >>
            {
            var viewRegion = new InputRecordViewRegion();
            viewRegion.Name = "header";
            viewRegion.Label = "Header";
            viewRegion.Render = true;
            viewRegion.Weight = Decimal.Parse("1.0");
            viewRegion.CssClass = "";
            viewRegion.Sections = new List<InputRecordViewSection>();

            #region << Section: section >>
            {
            var viewSection = new InputRecordViewSection();
            viewSection.Id = new Guid("f1aa9f94-1c67-4a38-bab6-6c3e9a2d9834");
            viewSection.Name = "section";
            viewSection.Label = "Section name";
            viewSection.ShowLabel = false;
            viewSection.CssClass = "";
            viewSection.Collapsed = false;
            viewSection.TabOrder = "left-right";
            viewSection.Weight = Decimal.Parse("1.0");
            viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row 1>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("9a1a6e16-9dbc-4690-9e29-52627f099e33");
                    viewRow.Weight = Decimal.Parse("1.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("12");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd");
                        viewItem.EntityName = "wv_sprint";
                        viewItem.FieldId = new Guid("a313b778-392d-4214-8c1a-e2a591b8a9dd");
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
                #region << Row 2>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("5477e48f-1925-4881-98f9-bbc2c0e961fb");
                    viewRow.Weight = Decimal.Parse("2.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << start_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd");
                        viewItem.EntityName = "wv_sprint";
                        viewItem.FieldId = new Guid("0d2f3748-5ae8-40ab-bba2-fe5a6f249568");
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        viewItemFromRelation.EntityName = "role";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Allowed roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = "";
                        viewItemFromRelation.FieldRequired = false;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("e77b7a71-134e-41bf-a079-008e8931303f");
                        viewItemFromRelation.RelationName = "role_n_n_wv_sprint";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                    #region << Column 2 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << end_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd");
                        viewItem.EntityName = "wv_sprint";
                        viewItem.FieldId = new Guid("63bd86c4-adac-4de1-a24a-5cb4a3a0a73f");
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
            //Save section
            viewRegion.Sections.Add(viewSection);
            }
            #endregion
            //Save region
            createViewInput.Regions.Add(viewRegion);
            }
            #endregion

            #endregion

            #region << Relation options >>
            {
            createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
            }
            #endregion

            #region << Action items >>
            {
            createViewInput.ActionItems = new List<ActionItem>();

            #region << action item: wv_back_button >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_back_button";
            actionItem.Menu = "sidebar-top";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_record_delete >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_record_delete";
            actionItem.Menu = "page-title-dropdown";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a href=""javascript:void(0)"" confirmed-click=""ngCtrl.deleteRecord(ngCtrl)"" ng-confirm-click=""{{'DELETE_CONFIRMATION_ALERT_MESSAGE' | translate}}""
             ng-if=""::ngCtrl.userHasRecordPermissions('canDelete')"">
             <i class=""fa fa-trash go-red""></i> Delete Record
             </a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            }
            #endregion

            #region << Sidebar >>
            createViewInput.Sidebar = new InputRecordViewSidebar();
            createViewInput.Sidebar.CssClass = "";
            createViewInput.Sidebar.Render = false;
            createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

            #endregion
            {
            var response = entMan.UpdateRecordView(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd"), createViewInput);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_sprint Updated view: general Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_sprint View: create >>
            {
            var updateViewEntity = entMan.ReadEntity(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd")).Object;
            var createViewInput = new InputRecordView();

            #region << details >>
            createViewInput.Id = updateViewEntity.RecordViews.SingleOrDefault(x => x.Name == "create").Id;
            createViewInput.Type = "Create";
            createViewInput.Name = "create";
            createViewInput.Label = "create";
            createViewInput.Title = "Create sprint";
            createViewInput.Default = true;
            createViewInput.System = false;
            createViewInput.Weight = Decimal.Parse("10.0");
            createViewInput.CssClass = "";
            createViewInput.IconName = "file-text-o";
            createViewInput.DynamicHtmlTemplate = null;
            createViewInput.DataSourceUrl = null;
            createViewInput.ServiceCode = null;
            #endregion

            #region << regions >>
            createViewInput.Regions = new List<InputRecordViewRegion>();

            #region << Region: header >>
            {
            var viewRegion = new InputRecordViewRegion();
            viewRegion.Name = "header";
            viewRegion.Label = "Header";
            viewRegion.Render = true;
            viewRegion.Weight = Decimal.Parse("1.0");
            viewRegion.CssClass = "";
            viewRegion.Sections = new List<InputRecordViewSection>();

            #region << Section: section >>
            {
            var viewSection = new InputRecordViewSection();
            viewSection.Id = new Guid("f1aa9f94-1c67-4a38-bab6-6c3e9a2d9834");
            viewSection.Name = "section";
            viewSection.Label = "Section name";
            viewSection.ShowLabel = false;
            viewSection.CssClass = "";
            viewSection.Collapsed = false;
            viewSection.TabOrder = "left-right";
            viewSection.Weight = Decimal.Parse("1.0");
            viewSection.Rows = new List<InputRecordViewRow>();

                #region << Row 1>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("9a1a6e16-9dbc-4690-9e29-52627f099e33");
                    viewRow.Weight = Decimal.Parse("1.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("12");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << name >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd");
                        viewItem.EntityName = "wv_sprint";
                        viewItem.FieldId = new Guid("a313b778-392d-4214-8c1a-e2a591b8a9dd");
                        viewItem.FieldName = "name";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
                #region << Row 2>>
                {
                    var viewRow = new InputRecordViewRow();
                    viewRow.Id = new Guid("5477e48f-1925-4881-98f9-bbc2c0e961fb");
                    viewRow.Weight = Decimal.Parse("2.0");
                    viewRow.Columns = new List<InputRecordViewColumn>();

                    #region << Column 1 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << start_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd");
                        viewItem.EntityName = "wv_sprint";
                        viewItem.FieldId = new Guid("0d2f3748-5ae8-40ab-bba2-fe5a6f249568");
                        viewItem.FieldName = "start_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    #region << field from Relation: name >>
                    {
                        var viewItemFromRelation = new InputRecordViewRelationFieldItem();
                        viewItemFromRelation.EntityId = new Guid("c4541fee-fbb6-4661-929e-1724adec285a");
                        viewItemFromRelation.EntityName = "role";
                        viewItemFromRelation.Type = "fieldFromRelation";
                        viewItemFromRelation.FieldId = new Guid("36f91ebd-5a02-4032-8498-b7f716f6a349");
                        viewItemFromRelation.FieldName = "name";
                        viewItemFromRelation.FieldLabel = "Allowed roles";
                        viewItemFromRelation.FieldPlaceholder = "";
                        viewItemFromRelation.FieldHelpText = "";
                        viewItemFromRelation.FieldRequired = false;
                        viewItemFromRelation.FieldLookupList = "lookup";
                        viewItemFromRelation.RelationId = new Guid("e77b7a71-134e-41bf-a079-008e8931303f");
                        viewItemFromRelation.RelationName = "role_n_n_wv_sprint";
                        viewColumn.Items.Add(viewItemFromRelation);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                    #region << Column 2 >>
                    {
                    var viewColumn = new InputRecordViewColumn();
                    viewColumn.GridColCount = Int32.Parse("6");
                    viewColumn.Items = new List<InputRecordViewItemBase>();

                    #region << end_date >>
                    {
                        var viewItem = new InputRecordViewFieldItem();
                        viewItem.EntityId = new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd");
                        viewItem.EntityName = "wv_sprint";
                        viewItem.FieldId = new Guid("63bd86c4-adac-4de1-a24a-5cb4a3a0a73f");
                        viewItem.FieldName = "end_date";
                        viewItem.Type = "field";
                        viewColumn.Items.Add(viewItem);
                    }
                    #endregion
                    //Save column
                    viewRow.Columns.Add(viewColumn);
                    }
                    #endregion
                //Save row
                viewSection.Rows.Add(viewRow);
                }
                #endregion
            //Save section
            viewRegion.Sections.Add(viewSection);
            }
            #endregion
            //Save region
            createViewInput.Regions.Add(viewRegion);
            }
            #endregion

            #endregion

            #region << Relation options >>
            {
            createViewInput.RelationOptions = new List<EntityRelationOptionsItem>();
            }
            #endregion

            #region << Action items >>
            {
            createViewInput.ActionItems = new List<ActionItem>();

            #region << action item: wv_create_and_list >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_and_list";
            actionItem.Menu = "create-bottom";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""btn btn-primary"" ng-click='ngCtrl.create(""default"")' ng-if=""::ngCtrl.createViewRegion != null"">Create</a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_back_button >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_back_button";
            actionItem.Menu = "sidebar-top";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""back clearfix"" href=""javascript:void(0)"" ng-click=""sidebarData.goBack()""><i class=""fa fa-fw fa-arrow-left""></i> <span class=""text"">Back</span></a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_create_cancel >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_cancel";
            actionItem.Menu = "create-bottom";
            actionItem.Weight = Decimal.Parse("3.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-click=""ngCtrl.cancel()"">Cancel</a>";
            createViewInput.ActionItems.Add(actionItem);
            }
            #endregion

            }
            #endregion

            #region << Sidebar >>
            createViewInput.Sidebar = new InputRecordViewSidebar();
            createViewInput.Sidebar.CssClass = "";
            createViewInput.Sidebar.Render = false;
            createViewInput.Sidebar.Items = new List<InputRecordViewSidebarItemBase>();

            #endregion
            {
            var response = entMan.UpdateRecordView(new Guid("a8de737a-9610-424d-9cf1-1b86e6cd17cd"), createViewInput);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_sprint Updated view: create Message:" + response.Message);
            }
            }
            #endregion

            #region << Update  Entity: wv_customer name: admin >>
            {
            var createListEntity = entMan.ReadEntity(new Guid("90bcdb47-2cde-4137-a412-0198348fecc0")).Object;
            var createListInput = new InputRecordList();

            #region << details >>
            createListInput.Id = createListEntity.RecordLists.SingleOrDefault(x => x.Name == "admin").Id;
            createListInput.Type =  "Hidden";
            createListInput.Name = "admin";
            createListInput.Label = "Customers";
            createListInput.Title = null;
            createListInput.Weight = Decimal.Parse("11.0");
            createListInput.Default = false;
            createListInput.System = true;
            createListInput.CssClass = null;
            createListInput.IconName = "building-o";
            createListInput.VisibleColumnsCount = Int32.Parse("7");
            createListInput.ColumnWidthsCSV = null;
            createListInput.PageSize = Int32.Parse("10");
            createListInput.DynamicHtmlTemplate = null;
            createListInput.DataSourceUrl = null;
            createListInput.ServiceCode = null;
            #endregion

            #region << Relation options >>
            {
            createListInput.RelationOptions = new List<EntityRelationOptionsItem>();
            }
            #endregion

            #region << Action items >>
            {
            createListInput.ActionItems = new List<ActionItem>();

            #region << action item: wv_create_record >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_create_record";
            actionItem.Menu = "page-title";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline hidden-xs"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate')""
            ng-href=""{{::ngCtrl.getRecordCreateUrl(ngCtrl)}}"">Add New</a>";
            createListInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_record_details >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_record_details";
            actionItem.Menu = "record-row";
            actionItem.Weight = Decimal.Parse("1.0");
            actionItem.Template = @"<a class=""btn btn-default btn-outline"" ng-href=""{{::ngCtrl.getRecordDetailsUrl(record, ngCtrl)}}"">
                            <i class=""fa fa-fw fa-eye""></i>
                            </a>";
            createListInput.ActionItems.Add(actionItem);
            }
            #endregion

            #region << action item: wv_export_records >>
            {
            var actionItem = new ActionItem();
            actionItem.Name = "wv_export_records";
            actionItem.Menu = "page-title-dropdown";
            actionItem.Weight = Decimal.Parse("11.0");
            actionItem.Template = @"<a ng-click=""ngCtrl.openExportModal()"" class=""ng-hide"" ng-show=""::ngCtrl.userHasRecordPermissions('canCreate,canUpdate')"">
            <i class=""fa fa-fw fa-download""></i> Export CSV
            </a>";
            createListInput.ActionItems.Add(actionItem);
            }
            #endregion

            }
            #endregion

            #region << Columns >>
            {
            createListInput.Columns = new List<InputRecordListItemBase>();

            #region << name >>
            {
            var listField = new InputRecordListFieldItem();
            listField.EntityId = new Guid("90bcdb47-2cde-4137-a412-0198348fecc0");
            listField.EntityName = "wv_customer";
            listField.FieldId = new Guid("7fb95d0f-ab59-421d-974d-ab357e28a1f9");
            listField.FieldName = "name";
            listField.Type = "field";
            createListInput.Columns.Add(listField);
            }
            #endregion
            }
            #endregion

            #region << Query >>
            {
            createListInput.Query = new InputRecordListQuery();
            var queryDictionary = new Dictionary<Guid,InputRecordListQuery>();
            var subQueryDictionary = new Dictionary<Guid,List<InputRecordListQuery>>();
            //Main query rule
            createListInput.Query.FieldName = null;
            createListInput.Query.FieldValue =  null;
            createListInput.Query.QueryType = "AND";
            createListInput.Query.SubQueries = new List<InputRecordListQuery>();
            {
            queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")] = new InputRecordListQuery();
            queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")].FieldName = "name";
            queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")].FieldValue =  "{\"name\":\"url_query\", \"option\": \"name\", \"default\": null, \"settings\":{}}";
            queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")].QueryType = "CONTAINS";
            queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")].SubQueries = new List<InputRecordListQuery>();
            if(subQueryDictionary.ContainsKey(new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e"))) {queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")].SubQueries = subQueryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")];}
            if(!subQueryDictionary.ContainsKey(new Guid("da2c6f8f-75ad-4ba5-847b-85f7ceecebd3"))) {subQueryDictionary[new Guid("da2c6f8f-75ad-4ba5-847b-85f7ceecebd3")] = new List<InputRecordListQuery>();}
            subQueryDictionary[new Guid("da2c6f8f-75ad-4ba5-847b-85f7ceecebd3")].Add(queryDictionary[new Guid("8a8380ab-b6eb-4d55-bf94-a7be70e8d37e")]);
            }
            if(subQueryDictionary.ContainsKey(new Guid("da2c6f8f-75ad-4ba5-847b-85f7ceecebd3"))) {createListInput.Query.SubQueries = subQueryDictionary[new Guid("da2c6f8f-75ad-4ba5-847b-85f7ceecebd3")];}
            }
            #endregion

            #region << Sorts >>
            {
            createListInput.Sorts = new List<InputRecordListSort>();

            #region << sort >>
            {
            var sort = new InputRecordListSort();
            sort.FieldName = "{\"name\":\"url_sort\", \"option\": \"sortBy\", \"default\": null, \"settings\":{\"order\":\"sortOrder\"}}";
            sort.SortType = "Ascending";
            createListInput.Sorts.Add(sort);
            }
            #endregion

            }
            #endregion

            {
            var response = entMan.UpdateRecordList(new Guid("90bcdb47-2cde-4137-a412-0198348fecc0"), createListInput);
            if (!response.Success)
            throw new Exception("System error 10060. Entity: wv_customer Updated list: admin Message:" + response.Message);
            }
            }
            #endregion
        }
Beispiel #20
0
 private static void Patch160714(EntityManager entMan, EntityRelationManager relMan, RecordManager recMan, bool createSampleRecords = false)
 {
 }
Beispiel #21
0
        public void InitializeSystemEntities()
        {
            EntityResponse response = null;
            FieldResponse fieldResponse = null;
            EntityManager em = new EntityManager(StorageService);
            EntityRelationManager rm = new EntityRelationManager(StorageService);
            RecordManager recMan = new RecordManager(this);

            var transaction = recMan.CreateTransaction();

            try
            {

                transaction.Begin();

                IStorageSystemSettingsRepository systemSettingsRepository = StorageService.GetSystemSettingsRepository();
                IStorageSystemSettings storeSystemSettings = systemSettingsRepository.Read();

                Guid systemSettingsId = new Guid("F3223177-B2FF-43F5-9A4B-FF16FC67D186");
                SystemSettings systemSettings = new SystemSettings();
                systemSettings.Id = systemSettingsId;

                int currentVersion = 0;
                if (storeSystemSettings != null)
                {
                    systemSettings = new SystemSettings(storeSystemSettings);
                    currentVersion = systemSettings.Version;
                }

                EntityManager entityManager = new EntityManager(StorageService);

                //tmp code - during debug only
                //em.DeleteEntity(SystemIds.UserEntityId);
                //em.DeleteEntity(SystemIds.RoleEntityId);
                //rm.Delete(SystemIds.UserRoleRelationId);
                //currentVersion = 0;

                if (currentVersion < 150508)
                {
                    systemSettings.Version = 150508;

                    List<Guid> allowedRoles = new List<Guid>();
                    allowedRoles.Add(SystemIds.AdministratorRoleId);

                    #region << create role entity >>

                    {
                        InputEntity roleEntity = new InputEntity();
                        roleEntity.Id = SystemIds.RoleEntityId;
                        roleEntity.Name = "role";
                        roleEntity.Label = "Role";
                        roleEntity.LabelPlural = "Roles";
                        roleEntity.System = true;
                        roleEntity.RecordPermissions = new RecordPermissions();
                        roleEntity.RecordPermissions.CanRead = allowedRoles;
                        roleEntity.RecordPermissions.CanCreate = allowedRoles;
                        roleEntity.RecordPermissions.CanUpdate = allowedRoles;
                        roleEntity.RecordPermissions.CanDelete = allowedRoles;

                        response = entityManager.CreateEntity(roleEntity);

                        InputTextField nameRoleField = new InputTextField();

                        nameRoleField.Id = new Guid("36F91EBD-5A02-4032-8498-B7F716F6A349");
                        nameRoleField.Name = "name";
                        nameRoleField.Label = "Name";
                        nameRoleField.PlaceholderText = "";
                        nameRoleField.Description = "The name of the role";
                        nameRoleField.HelpText = "";
                        nameRoleField.Required = true;
                        nameRoleField.Unique = false;
                        nameRoleField.Searchable = false;
                        nameRoleField.Auditable = false;
                        nameRoleField.System = true;
                        nameRoleField.DefaultValue = "";

                        nameRoleField.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(roleEntity.Id.Value, nameRoleField, false);

                        InputTextField descriptionRoleField = new InputTextField();

                        descriptionRoleField.Id = new Guid("4A8B9E0A-1C36-40C6-972B-B19E2B5D265B");
                        descriptionRoleField.Name = "description";
                        descriptionRoleField.Label = "Description";
                        descriptionRoleField.PlaceholderText = "";
                        descriptionRoleField.Description = "";
                        descriptionRoleField.HelpText = "";
                        descriptionRoleField.Required = true;
                        descriptionRoleField.Unique = false;
                        descriptionRoleField.Searchable = false;
                        descriptionRoleField.Auditable = false;
                        descriptionRoleField.System = true;
                        descriptionRoleField.DefaultValue = "";

                        descriptionRoleField.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(roleEntity.Id.Value, descriptionRoleField, false);
                    }

                    #endregion

                    #region << create user entity >>
                    {

                        InputEntity userEntity = new InputEntity();
                        userEntity.Id = SystemIds.UserEntityId;
                        userEntity.Name = "user";
                        userEntity.Label = "User";
                        userEntity.LabelPlural = "Users";
                        userEntity.System = true;
                        userEntity.RecordPermissions = new RecordPermissions();
                        userEntity.RecordPermissions.CanRead = allowedRoles;
                        userEntity.RecordPermissions.CanCreate = allowedRoles;
                        userEntity.RecordPermissions.CanUpdate = allowedRoles;
                        userEntity.RecordPermissions.CanDelete = allowedRoles;

                        response = entityManager.CreateEntity(userEntity);

                        InputTextField firstName = new InputTextField();

                        firstName.Id = new Guid("DF211549-41CC-4D11-BB43-DACA4C164411");
                        firstName.Name = "first_name";
                        firstName.Label = "First Name";
                        firstName.PlaceholderText = "";
                        firstName.Description = "First name of the user";
                        firstName.HelpText = "";
                        firstName.Required = true;
                        firstName.Unique = false;
                        firstName.Searchable = false;
                        firstName.Auditable = false;
                        firstName.System = true;
                        firstName.DefaultValue = "";

                        firstName.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, firstName, false);

                        InputTextField lastName = new InputTextField();

                        lastName.Id = new Guid("63E685B1-B2C6-4961-B393-2B6723EBD1BF");
                        lastName.Name = "last_name";
                        lastName.Label = "Last Name";
                        lastName.PlaceholderText = "";
                        lastName.Description = "Last name of the user";
                        lastName.HelpText = "";
                        lastName.Required = true;
                        lastName.Unique = false;
                        lastName.Searchable = false;
                        lastName.Auditable = false;
                        lastName.System = true;
                        lastName.DefaultValue = "";

                        lastName.MaxLength = 200;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, lastName, false);

                        InputEmailField email = new InputEmailField();

                        email.Id = new Guid("9FC75C8F-CE80-4A64-81D7-E2BEFA5E4815");
                        email.Name = "email";
                        email.Label = "Email";
                        email.PlaceholderText = "";
                        email.Description = "Email address of the user";
                        email.HelpText = "";
                        email.Required = true;
                        email.Unique = true;
                        email.Searchable = false;
                        email.Auditable = false;
                        email.System = true;
                        email.DefaultValue = "";

                        email.MaxLength = 255;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, email, false);

                        InputPasswordField password = new InputPasswordField();

                        password.Id = new Guid("4EDE88D9-217A-4462-9300-EA0D6AFCDCEA");
                        password.Name = "password";
                        password.Label = "Password";
                        password.PlaceholderText = "";
                        password.Description = "Password for the user account";
                        password.HelpText = "";
                        password.Required = true;
                        password.Unique = true;
                        password.Searchable = false;
                        password.Auditable = false;
                        password.System = true;
                        password.MinLength = 6;
                        password.MaxLength = 24;
                        password.Encrypted = true;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, password, false);

                        InputDateTimeField lastLoggedIn = new InputDateTimeField();

                        lastLoggedIn.Id = new Guid("3C85CCEC-D526-4E47-887F-EE169D1F508D");
                        lastLoggedIn.Name = "last_logged_in";
                        lastLoggedIn.Label = "Last Logged In";
                        lastLoggedIn.PlaceholderText = "";
                        lastLoggedIn.Description = "";
                        lastLoggedIn.HelpText = "";
                        lastLoggedIn.Required = false;
                        lastLoggedIn.Unique = true;
                        lastLoggedIn.Searchable = false;
                        lastLoggedIn.Auditable = true;
                        lastLoggedIn.System = true;
                        lastLoggedIn.DefaultValue = null;

                        lastLoggedIn.Format = "dd MMM yyyy HH:mm:ss";
                        lastLoggedIn.UseCurrentTimeAsDefaultValue = true;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, lastLoggedIn, false);

                        InputCheckboxField enabledField = new InputCheckboxField();

                        enabledField.Id = new Guid("C0C63650-7572-4252-8E4B-4E25C94897A6");
                        enabledField.Name = "enabled";
                        enabledField.Label = "Enabled";
                        enabledField.PlaceholderText = "";
                        enabledField.Description = "Shows if the user account is enabled";
                        enabledField.HelpText = "";
                        enabledField.Required = true;
                        enabledField.Unique = false;
                        enabledField.Searchable = false;
                        enabledField.Auditable = false;
                        enabledField.System = true;
                        enabledField.DefaultValue = false;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, enabledField, false);

                        InputCheckboxField verifiedUserField = new InputCheckboxField();

                        verifiedUserField.Id = new Guid("F1BA5069-8CC9-4E66-BCC3-60E33C79C265");
                        verifiedUserField.Name = "verified";
                        verifiedUserField.Label = "Verified";
                        verifiedUserField.PlaceholderText = "";
                        verifiedUserField.Description = "Shows if the user email is verified";
                        verifiedUserField.HelpText = "";
                        verifiedUserField.Required = true;
                        verifiedUserField.Unique = false;
                        verifiedUserField.Searchable = false;
                        verifiedUserField.Auditable = false;
                        verifiedUserField.System = true;
                        verifiedUserField.DefaultValue = false;

                        fieldResponse = entityManager.CreateField(userEntity.Id.Value, verifiedUserField, false);

                    }

                    #endregion

                    #region << create user - role relation >>
                    {
                        var userEntity = em.ReadEntity(SystemIds.UserEntityId).Object;
                        var roleEntity = em.ReadEntity(SystemIds.RoleEntityId).Object;

                        EntityRelation userRoleRelation = new EntityRelation();
                        userRoleRelation.Id = SystemIds.UserRoleRelationId;
                        userRoleRelation.Name = "user_role";
                        userRoleRelation.Label = "User-Role";
                        userRoleRelation.System = true;
                        userRoleRelation.RelationType = EntityRelationType.ManyToMany;
                        userRoleRelation.TargetEntityId = userEntity.Id;
                        userRoleRelation.TargetFieldId = userEntity.Fields.Single(x => x.Name == "id").Id;
                        userRoleRelation.OriginEntityId = roleEntity.Id;
                        userRoleRelation.OriginFieldId = roleEntity.Fields.Single(x => x.Name == "id").Id;
                        {
                            var result = rm.Create(userRoleRelation);
                            if (!result.Success)
                                throw new Exception("CREATE USER-ROLE RELATION:" + result.Message);
                        }
                    }
                    #endregion

                    #region << create system records >>

                    {
                        EntityRecord user = new EntityRecord();
                        user["id"] = SystemIds.FirstUserId;
                        user["first_name"] = "WebVella";
                        user["last_name"] = "Erp";
                        user["password"] = "******";
                        user["email"] = "*****@*****.**";
                        user["created_by"] = SystemIds.FirstUserId;
                        user["last_modified_by"] = SystemIds.FirstUserId;
                        user["created_on"] = DateTime.UtcNow;
                        user["enabled"] = true;

                        QueryResponse result = recMan.CreateRecord("user", user);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST USER RECORD:" + result.Message);
                    }

                    {
                        EntityRecord adminRole = new EntityRecord();
                        adminRole["id"] = SystemIds.AdministratorRoleId;
                        adminRole["name"] = "Administrator";
                        adminRole["description"] = "";
                        adminRole["created_by"] = SystemIds.FirstUserId;
                        adminRole["last_modified_by"] = SystemIds.FirstUserId;
                        adminRole["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("role", adminRole);
                        if (!result.Success)
                            throw new Exception("CREATE ADMINITRATOR ROLE RECORD:" + result.Message);
                    }

                    {
                        EntityRecord regularRole = new EntityRecord();
                        regularRole["id"] = SystemIds.RegularRoleId;
                        regularRole["name"] = "Regular";
                        regularRole["description"] = "";
                        regularRole["created_by"] = SystemIds.FirstUserId;
                        regularRole["last_modified_by"] = SystemIds.FirstUserId;
                        regularRole["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("role", regularRole);
                        if (!result.Success)
                            throw new Exception("CREATE REGULAR ROLE RECORD:" + result.Message);
                    }

                    {
                        EntityRecord guestRole = new EntityRecord();
                        guestRole["id"] = SystemIds.GuestRoleId;
                        guestRole["name"] = "Guest";
                        guestRole["description"] = "";
                        guestRole["created_by"] = SystemIds.FirstUserId;
                        guestRole["last_modified_by"] = SystemIds.FirstUserId;
                        guestRole["created_on"] = DateTime.UtcNow;

                        QueryResponse result = recMan.CreateRecord("role", guestRole);
                        if (!result.Success)
                            throw new Exception("CREATE GUEST ROLE RECORD:" + result.Message);
                    }

                    {
                        QueryResponse result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.AdministratorRoleId, SystemIds.FirstUserId);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST-USER <-> ADMINISTRATOR ROLE RELATION RECORD:" + result.Message);

                        result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.RegularRoleId, SystemIds.FirstUserId);
                        if (!result.Success)
                            throw new Exception("CREATE FIRST-USER <-> REGULAR ROLE RELATION RECORD:" + result.Message);

                    }

                    #endregion

                    #region << create Area entity >>
                    {
                        InputEntity areaEntity = new InputEntity();
                        areaEntity.Id = SystemIds.AreaEntityId;
                        areaEntity.Name = "area";
                        areaEntity.Label = "Area";
                        areaEntity.LabelPlural = "areas";
                        areaEntity.System = true;
                        areaEntity.IconName = "folder";
                        areaEntity.Weight = 10;
                        areaEntity.RecordPermissions = new RecordPermissions();
                        areaEntity.RecordPermissions.CanRead = allowedRoles;
                        areaEntity.RecordPermissions.CanCreate = allowedRoles;
                        areaEntity.RecordPermissions.CanUpdate = allowedRoles;
                        areaEntity.RecordPermissions.CanDelete = allowedRoles;
                        {
                            var createResponse = entityManager.CreateEntity(areaEntity);
                            if (!createResponse.Success)
                                throw new Exception("System error 10330. Message:" + createResponse.Message);
                        }

                        InputTextField color = new InputTextField();
                        color.Id = new Guid("2B4AACD9-3C34-4C44-B3A3-8AFF1520CFF6");
                        color.Name = "color";
                        color.Label = "Color";
                        color.PlaceholderText = "";
                        color.Description = "";
                        color.HelpText = "";
                        color.Required = true;
                        color.Unique = false;
                        color.Searchable = false;
                        color.Auditable = false;
                        color.System = true;
                        color.DefaultValue = "teal";
                        color.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, color, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField label = new InputTextField();
                        label.Id = new Guid("F050E7A1-AFB7-4346-B57B-1F12B2BD5AE5");
                        label.Name = "label";
                        label.Label = "Label";
                        label.PlaceholderText = "";
                        label.Description = "";
                        label.HelpText = "";
                        label.Required = true;
                        label.Unique = false;
                        label.Searchable = false;
                        label.Auditable = false;
                        label.System = true;
                        label.DefaultValue = "Default";
                        label.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, label, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField iconName = new InputTextField();
                        iconName.Id = new Guid("5EA0C872-D219-4D94-9EFA-C5DA978D316B");
                        iconName.Name = "icon_name";
                        iconName.Label = "Icon Name";
                        iconName.PlaceholderText = "";
                        iconName.Description = "";
                        iconName.HelpText = "";
                        iconName.Required = true;
                        iconName.Unique = false;
                        iconName.Searchable = false;
                        iconName.Auditable = false;
                        iconName.System = true;
                        iconName.DefaultValue = "database";
                        iconName.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, iconName, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputNumberField weight = new InputNumberField();
                        weight.Id = new Guid("9B169431-6C31-4141-80EB-5844B8333E63");
                        weight.Name = "weight";
                        weight.Label = "Weight";
                        weight.PlaceholderText = "";
                        weight.Description = "";
                        weight.HelpText = "";
                        weight.Required = true;
                        weight.Unique = false;
                        weight.Searchable = false;
                        weight.Auditable = false;
                        weight.System = true;
                        weight.DefaultValue = 10;
                        weight.MinValue = 0;
                        weight.DecimalPlaces = 2;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, weight, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField subscriptions = new InputTextField();
                        subscriptions.Id = new Guid("288EA657-C12C-4AC1-B701-81D6F9F39363");
                        subscriptions.Name = "subscriptions";
                        subscriptions.Label = "Subscriptions JSON String";
                        subscriptions.PlaceholderText = "";
                        subscriptions.Description = "Stringified Array of subscription objects";
                        subscriptions.HelpText = "";
                        subscriptions.Required = false;
                        subscriptions.Unique = false;
                        subscriptions.Searchable = false;
                        subscriptions.Auditable = false;
                        subscriptions.System = true;
                        subscriptions.DefaultValue = null;
                        subscriptions.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, subscriptions, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField name = new InputTextField();
                        name.Id = new Guid("F297577B-073E-4D18-81F3-675C1AFB466D");
                        name.Name = "name";
                        name.Label = "Name";
                        name.PlaceholderText = "";
                        name.Description = "";
                        name.HelpText = "";
                        name.Required = true;
                        name.Unique = false;
                        name.Searchable = false;
                        name.Auditable = false;
                        name.System = true;
                        name.DefaultValue = "default";
                        name.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, name, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField roles = new InputTextField();
                        roles.Id = new Guid("8E486F76-D0C1-4D0E-8617-9EF868BF1C55");
                        roles.Name = "roles";
                        roles.Label = "Subscriptions JSON String";
                        roles.PlaceholderText = "";
                        roles.Description = "Stringified Array of roles that have access to this area";
                        roles.HelpText = "";
                        roles.Required = false;
                        roles.Unique = false;
                        roles.Searchable = false;
                        roles.Auditable = false;
                        roles.System = true;
                        roles.DefaultValue = null;
                        roles.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.AreaEntityId, roles, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                    }
                    #endregion
                }

                if (currentVersion < 150919)
                {
                    systemSettings.Version = 150919;
                    List<Guid> allowedRoles = new List<Guid>();
                    allowedRoles.Add(SystemIds.AdministratorRoleId);
                    Guid filterEntityId = new Guid("2a20e8b1-5713-4257-a860-b964a5cfb317");

                    #region << create filter >>
                    {
                        InputEntity filterEntity = new InputEntity();
                        filterEntity.Id = filterEntityId;
                        filterEntity.Name = "filter";
                        filterEntity.Label = "Filter";
                        filterEntity.LabelPlural = "Filters";
                        filterEntity.System = true;
                        filterEntity.IconName = "filter";
                        filterEntity.Weight = 100;
                        filterEntity.RecordPermissions = new RecordPermissions();
                        filterEntity.RecordPermissions.CanRead = allowedRoles;
                        filterEntity.RecordPermissions.CanCreate = allowedRoles;
                        filterEntity.RecordPermissions.CanUpdate = allowedRoles;
                        filterEntity.RecordPermissions.CanDelete = allowedRoles;
                        {
                            var createResponse = entityManager.CreateEntity(filterEntity);
                            if (!createResponse.Success)
                                throw new Exception("System error 10330. Message:" + createResponse.Message);
                        }

                        InputTextField filterId = new InputTextField();
                        filterId.Id = new Guid("597bd9f4-c534-4244-af88-b6970c6abb21");
                        filterId.Name = "filter_id";
                        filterId.Label = "Filter id";
                        filterId.PlaceholderText = "";
                        filterId.Description = "";
                        filterId.HelpText = "";
                        filterId.Required = true;
                        filterId.Unique = false;
                        filterId.Searchable = false;
                        filterId.Auditable = false;
                        filterId.System = true;
                        filterId.DefaultValue = "";
                        filterId.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, filterId, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField fieldName = new InputTextField();
                        fieldName.Id = new Guid("e4094c4d-0fd3-44ef-9cc0-190ea48f7bca");
                        fieldName.Name = "field_name";
                        fieldName.Label = "Field name";
                        fieldName.PlaceholderText = "";
                        fieldName.Description = "";
                        fieldName.HelpText = "";
                        fieldName.Required = true;
                        fieldName.Unique = false;
                        fieldName.Searchable = false;
                        fieldName.Auditable = false;
                        fieldName.System = true;
                        fieldName.DefaultValue = "";
                        fieldName.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, fieldName, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField relationName = new InputTextField();
                        relationName.Id = new Guid("2859082c-5356-4d13-8b7b-e8fe65417279");
                        relationName.Name = "relation_name";
                        relationName.Label = "Relation name";
                        relationName.PlaceholderText = "";
                        relationName.Description = "";
                        relationName.HelpText = "";
                        relationName.Required = true;
                        relationName.Unique = false;
                        relationName.Searchable = false;
                        relationName.Auditable = false;
                        relationName.System = true;
                        relationName.DefaultValue = "";
                        relationName.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, relationName, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField values = new InputTextField();
                        values.Id = new Guid("ff7511ae-0117-41c6-9a03-08e3c6568c39");
                        values.Name = "values";
                        values.Label = "Values";
                        values.PlaceholderText = "";
                        values.Description = "array of encoded strings";
                        values.HelpText = "";
                        values.Required = true;
                        values.Unique = false;
                        values.Searchable = false;
                        values.Auditable = false;
                        values.System = true;
                        values.DefaultValue = "";
                        values.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, values, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField helper = new InputTextField();
                        helper.Id = new Guid("9056b9fb-4a4a-456f-9c64-539eaf70b6b2");
                        helper.Name = "helper";
                        helper.Label = "Helper";
                        helper.PlaceholderText = "";
                        helper.Description = "stringified object that helps constructing the filter on the interface";
                        helper.HelpText = "";
                        helper.Required = true;
                        helper.Unique = false;
                        helper.Searchable = false;
                        helper.Auditable = false;
                        helper.System = true;
                        helper.DefaultValue = "";
                        helper.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, helper, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField entityName = new InputTextField();
                        entityName.Id = new Guid("22f58779-4c91-4278-8412-88e1a55784e1");
                        entityName.Name = "entity_name";
                        entityName.Label = "Entity Name";
                        entityName.PlaceholderText = "";
                        entityName.Description = "";
                        entityName.HelpText = "";
                        entityName.Required = true;
                        entityName.Unique = false;
                        entityName.Searchable = false;
                        entityName.Auditable = false;
                        entityName.System = true;
                        entityName.DefaultValue = "";
                        entityName.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, entityName, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputTextField listName = new InputTextField();
                        listName.Id = new Guid("a2cb0965-fe51-42b0-a07d-765507da8865");
                        listName.Name = "list_name";
                        listName.Label = "List Name";
                        listName.PlaceholderText = "";
                        listName.Description = "";
                        listName.HelpText = "";
                        listName.Required = true;
                        listName.Unique = false;
                        listName.Searchable = false;
                        listName.Auditable = false;
                        listName.System = true;
                        listName.DefaultValue = "";
                        listName.MaxLength = null;
                        {
                            var createResponse = entityManager.CreateField(filterEntityId, listName, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        InputDateTimeField lastUsedOn = new InputDateTimeField();

                        lastUsedOn.Id = new Guid("207cf27b-3595-41fd-b028-bcd47845ad25");
                        lastUsedOn.Name = "last_used_on";
                        lastUsedOn.Label = "Last used on";
                        lastUsedOn.PlaceholderText = "";
                        lastUsedOn.Description = "";
                        lastUsedOn.HelpText = "";
                        lastUsedOn.Required = true;
                        lastUsedOn.Unique = false;
                        lastUsedOn.Searchable = false;
                        lastUsedOn.Auditable = false;
                        lastUsedOn.System = true;
                        lastUsedOn.DefaultValue = null;
                        lastUsedOn.Format = "dd  MMM yyyy HH:mm:ss";
                        lastUsedOn.UseCurrentTimeAsDefaultValue = true;

                        {
                            var createResponse = entityManager.CreateField(filterEntityId, lastUsedOn, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10340. Message:" + createResponse.Message);
                        }

                        #region << match_type >>
                        InputSelectField matchType = new InputSelectField();
                        matchType.Id = new Guid("15416751-e66d-4b85-ae2f-974255f9c987");
                        matchType.Name = "match_type";
                        matchType.Label = "Match type";
                        matchType.PlaceholderText = "";
                        matchType.Description = "";
                        matchType.HelpText = "";
                        matchType.Required = true;
                        matchType.Unique = false;
                        matchType.Searchable = false;
                        matchType.Auditable = false;
                        matchType.System = true;
                        matchType.DefaultValue = "exact";
                        matchType.Options = null;
                        matchType.Options = new List<SelectFieldOption>
                            {
                                new SelectFieldOption(){ Key = "exact", Value = "Exact match" },
                                new SelectFieldOption(){ Key = "range", Value = "Range" },
                                new SelectFieldOption(){ Key = "period", Value = "Period" },
                                new SelectFieldOption(){ Key = "regex", Value = "Regex" }
                            };

                        {
                            var createResponse = entityManager.CreateField(filterEntityId, matchType, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10060. Entity: filter. Field: match_type" + " Message:" + createResponse.Message);
                        }
                        #endregion

                    }
                    #endregion

                }

                if (currentVersion < 150924)
                {
                    systemSettings.Version = 150924;
                    //User
                    #region << image >>
                    {
                        InputImageField imageField = new InputImageField();
                        imageField.Id = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                        imageField.Name = "image";
                        imageField.Label = "Image";
                        imageField.PlaceholderText = "";
                        imageField.Description = "";
                        imageField.HelpText = "";
                        imageField.Required = false;
                        imageField.Unique = false;
                        imageField.Searchable = false;
                        imageField.Auditable = false;
                        imageField.System = true;
                        imageField.DefaultValue = string.Empty;
                        imageField.EnableSecurity = false;
                        {
                            var createResponse = entityManager.CreateField(SystemIds.UserEntityId, imageField, false);
                            if (!createResponse.Success)
                                throw new Exception("System error 10060. Entity: user. Field: image" + " Message:" + createResponse.Message);
                        }
                    }
                    #endregion
                }

                storeSystemSettings = systemSettingsRepository.Convert(systemSettings);
                systemSettingsRepository.Save(storeSystemSettings);

                //if (currentVersion == 150508) //update to 150510
                //{
                //    systemSettings.Version = 150510;

                //    storeSystemSettings = systemSettingsRepository.Convert(systemSettings);
                //    systemSettingsRepository.Save(storeSystemSettings);
                //}

                transaction.Commit();
            }
            catch (Exception)
            {
                transaction.Rollback();
                throw;
            }
        }
Beispiel #22
0
        public void InitializeSystemEntities()
        {
            EntityResponse response = null;
            FieldResponse fieldResponse = null;
            EntityManager entMan = new EntityManager();
            EntityRelationManager rm = new EntityRelationManager();
            RecordManager recMan = new RecordManager(true);

            using (var connection = DbContext.Current.CreateConnection())
            {
                //setup necessary extensions
                DbRepository.CreatePostgresqlExtensions();

                try
                {
                    connection.BeginTransaction();

                    CheckCreateSystemTables();

                    DbSystemSettings storeSystemSettings = DbContext.Current.SettingsRepository.Read();

                    Guid systemSettingsId = new Guid("F3223177-B2FF-43F5-9A4B-FF16FC67D186");
                    SystemSettings systemSettings = new SystemSettings();
                    systemSettings.Id = systemSettingsId;

                    int currentVersion = 0;
                    if (storeSystemSettings != null)
                    {
                        systemSettings = new SystemSettings(storeSystemSettings);
                        currentVersion = systemSettings.Version;
                    }

                    //tmp code - during debug only
                    //entityManager.DeleteEntity(SystemIds.UserEntityId);
                    //entityManager.DeleteEntity(SystemIds.RoleEntityId);
                    //rm.Delete(SystemIds.UserRoleRelationId);
                    //currentVersion = 0;

                    if (currentVersion < 150508)
                    {
                        systemSettings.Version = 150508;

                        List<Guid> allowedRoles = new List<Guid>();
                        allowedRoles.Add(SystemIds.AdministratorRoleId);

                        #region << create user entity >>
                        {

                            InputEntity userEntity = new InputEntity();
                            userEntity.Id = SystemIds.UserEntityId;
                            userEntity.Name = "user";
                            userEntity.Label = "User";
                            userEntity.LabelPlural = "Users";
                            userEntity.System = true;
                            userEntity.RecordPermissions = new RecordPermissions();
                            userEntity.RecordPermissions.CanCreate = new List<Guid>();
                            userEntity.RecordPermissions.CanRead = new List<Guid>();
                            userEntity.RecordPermissions.CanUpdate = new List<Guid>();
                            userEntity.RecordPermissions.CanDelete = new List<Guid>();
                            userEntity.RecordPermissions.CanCreate.Add(SystemIds.GuestRoleId);
                            userEntity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                            userEntity.RecordPermissions.CanRead.Add(SystemIds.GuestRoleId);
                            userEntity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                            userEntity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                            userEntity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                            userEntity.RecordPermissions.CanDelete.Add(SystemIds.AdministratorRoleId);
                            var systemItemIdDictionary = new Dictionary<string, Guid>();
                            systemItemIdDictionary["id"] = new Guid("8e438549-fd30-4766-95a9-061008cee48e");
                            systemItemIdDictionary["created_on"] = new Guid("6fda5e6b-80e6-4d8a-9e2a-d983c3694e96");
                            systemItemIdDictionary["created_by"] = new Guid("825e8367-3be1-4022-ba66-6494859d70d9");
                            systemItemIdDictionary["last_modified_on"] = new Guid("5a975d33-47c6-4ba6-83c8-c24034206879");
                            systemItemIdDictionary["last_modified_by"] = new Guid("cafc8cda-1a1d-43e4-9406-6acf8ba8fa8d");
                            response = entMan.CreateEntity(userEntity, false, false, systemItemIdDictionary);

                            InputTextField firstName = new InputTextField();

                            firstName.Id = new Guid("DF211549-41CC-4D11-BB43-DACA4C164411");
                            firstName.Name = "first_name";
                            firstName.Label = "First Name";
                            firstName.PlaceholderText = "";
                            firstName.Description = "First name of the user";
                            firstName.HelpText = "";
                            firstName.Required = false;
                            firstName.Unique = false;
                            firstName.Searchable = false;
                            firstName.Auditable = false;
                            firstName.System = true;
                            firstName.DefaultValue = "";

                            firstName.MaxLength = 200;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, firstName, false);

                            InputTextField lastName = new InputTextField();

                            lastName.Id = new Guid("63E685B1-B2C6-4961-B393-2B6723EBD1BF");
                            lastName.Name = "last_name";
                            lastName.Label = "Last Name";
                            lastName.PlaceholderText = "";
                            lastName.Description = "Last name of the user";
                            lastName.HelpText = "";
                            lastName.Required = false;
                            lastName.Unique = false;
                            lastName.Searchable = false;
                            lastName.Auditable = false;
                            lastName.System = true;
                            lastName.DefaultValue = "";

                            lastName.MaxLength = 200;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, lastName, false);

                            InputTextField userName = new InputTextField();
                            userName.Id = new Guid("263c0b21-88c1-4c2b-80b4-db7402b0d2e2");
                            userName.Name = "username";
                            userName.Label = "User Name";
                            userName.PlaceholderText = "";
                            userName.Description = "screen name for the user";
                            userName.HelpText = "";
                            userName.Required = true;
                            userName.Unique = true;
                            userName.Searchable = true;
                            userName.Auditable = false;
                            userName.System = true;
                            userName.DefaultValue = string.Empty;
                            userName.MaxLength = 200;
                            fieldResponse = entMan.CreateField(userEntity.Id.Value, userName, false);

                            InputEmailField email = new InputEmailField();

                            email.Id = new Guid("9FC75C8F-CE80-4A64-81D7-E2BEFA5E4815");
                            email.Name = "email";
                            email.Label = "Email";
                            email.PlaceholderText = "";
                            email.Description = "Email address of the user";
                            email.HelpText = "";
                            email.Required = true;
                            email.Unique = true;
                            email.Searchable = true;
                            email.Auditable = false;
                            email.System = true;
                            email.DefaultValue = string.Empty;

                            email.MaxLength = 255;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, email, false);

                            InputPasswordField password = new InputPasswordField();

                            password.Id = new Guid("4EDE88D9-217A-4462-9300-EA0D6AFCDCEA");
                            password.Name = "password";
                            password.Label = "Password";
                            password.PlaceholderText = "";
                            password.Description = "Password for the user account";
                            password.HelpText = "";
                            password.Required = true;
                            password.Unique = false;
                            password.Searchable = false;
                            password.Auditable = false;
                            password.System = true;
                            password.MinLength = 6;
                            password.MaxLength = 24;
                            password.Encrypted = true;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, password, false);

                            InputDateTimeField lastLoggedIn = new InputDateTimeField();

                            lastLoggedIn.Id = new Guid("3C85CCEC-D526-4E47-887F-EE169D1F508D");
                            lastLoggedIn.Name = "last_logged_in";
                            lastLoggedIn.Label = "Last Logged In";
                            lastLoggedIn.PlaceholderText = "";
                            lastLoggedIn.Description = "";
                            lastLoggedIn.HelpText = "";
                            lastLoggedIn.Required = false;
                            lastLoggedIn.Unique = false;
                            lastLoggedIn.Searchable = false;
                            lastLoggedIn.Auditable = true;
                            lastLoggedIn.System = true;
                            lastLoggedIn.DefaultValue = null;

                            lastLoggedIn.Format = "dd MMM yyyy HH:mm:ss";
                            lastLoggedIn.UseCurrentTimeAsDefaultValue = true;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, lastLoggedIn, false);

                            InputCheckboxField enabledField = new InputCheckboxField();

                            enabledField.Id = new Guid("C0C63650-7572-4252-8E4B-4E25C94897A6");
                            enabledField.Name = "enabled";
                            enabledField.Label = "Enabled";
                            enabledField.PlaceholderText = "";
                            enabledField.Description = "Shows if the user account is enabled";
                            enabledField.HelpText = "";
                            enabledField.Required = true;
                            enabledField.Unique = false;
                            enabledField.Searchable = false;
                            enabledField.Auditable = false;
                            enabledField.System = true;
                            enabledField.DefaultValue = false;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, enabledField, false);

                            InputCheckboxField verifiedUserField = new InputCheckboxField();

                            verifiedUserField.Id = new Guid("F1BA5069-8CC9-4E66-BCC3-60E33C79C265");
                            verifiedUserField.Name = "verified";
                            verifiedUserField.Label = "Verified";
                            verifiedUserField.PlaceholderText = "";
                            verifiedUserField.Description = "Shows if the user email is verified";
                            verifiedUserField.HelpText = "";
                            verifiedUserField.Required = true;
                            verifiedUserField.Unique = false;
                            verifiedUserField.Searchable = false;
                            verifiedUserField.Auditable = false;
                            verifiedUserField.System = true;
                            verifiedUserField.DefaultValue = false;

                            fieldResponse = entMan.CreateField(userEntity.Id.Value, verifiedUserField, false);

                            #region << image >>
                            {
                                InputImageField imageField = new InputImageField();
                                imageField.Id = new Guid("bf199b74-4448-4f58-93f5-6b86d888843b");
                                imageField.Name = "image";
                                imageField.Label = "Image";
                                imageField.PlaceholderText = "";
                                imageField.Description = "";
                                imageField.HelpText = "";
                                imageField.Required = false;
                                imageField.Unique = false;
                                imageField.Searchable = false;
                                imageField.Auditable = false;
                                imageField.System = true;
                                imageField.DefaultValue = string.Empty;
                                imageField.EnableSecurity = false;
                                {
                                    var createResponse = entMan.CreateField(SystemIds.UserEntityId, imageField, false);
                                    if (!createResponse.Success)
                                        throw new Exception("System error 10060. Entity: user. Field: image" + " Message:" + createResponse.Message);
                                }
                            }
                            #endregion
                        }

                        #endregion

                        #region << create role entity >>

                        {
                            InputEntity roleEntity = new InputEntity();
                            roleEntity.Id = SystemIds.RoleEntityId;
                            roleEntity.Name = "role";
                            roleEntity.Label = "Role";
                            roleEntity.LabelPlural = "Roles";
                            roleEntity.System = true;
                            roleEntity.RecordPermissions = new RecordPermissions();
                            roleEntity.RecordPermissions.CanCreate = new List<Guid>();
                            roleEntity.RecordPermissions.CanRead = new List<Guid>();
                            roleEntity.RecordPermissions.CanUpdate = new List<Guid>();
                            roleEntity.RecordPermissions.CanDelete = new List<Guid>();
                            roleEntity.RecordPermissions.CanCreate.Add(SystemIds.GuestRoleId);
                            roleEntity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                            roleEntity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                            roleEntity.RecordPermissions.CanRead.Add(SystemIds.GuestRoleId);
                            roleEntity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                            roleEntity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                            roleEntity.RecordPermissions.CanDelete.Add(SystemIds.AdministratorRoleId);
                            var systemItemIdDictionary = new Dictionary<string, Guid>();
                            systemItemIdDictionary["id"] = new Guid("37fd9c4f-5413-4f3a-aa2f-d831cc106d03");
                            systemItemIdDictionary["created_on"] = new Guid("64047bab-dc73-4175-a744-e5d565e8adbb");
                            systemItemIdDictionary["created_by"] = new Guid("0ccd806b-715c-42d4-a580-f3f11f55d937");
                            systemItemIdDictionary["last_modified_on"] = new Guid("c4522433-1c67-44f9-b461-e85d4d363b70");
                            systemItemIdDictionary["last_modified_by"] = new Guid("a4489db4-9d76-4d5a-8940-6ef2da562c25");
                            systemItemIdDictionary["user_role_created_by"] = new Guid("c6151e80-9dce-4c0b-ae5f-4798e14cff4c");
                            systemItemIdDictionary["user_role_modified_by"] = new Guid("f3efaefe-32d2-4840-ac06-bc5723e323d0");
                            response = entMan.CreateEntity(roleEntity, false, false, systemItemIdDictionary);

                            InputTextField nameRoleField = new InputTextField();

                            nameRoleField.Id = new Guid("36F91EBD-5A02-4032-8498-B7F716F6A349");
                            nameRoleField.Name = "name";
                            nameRoleField.Label = "Name";
                            nameRoleField.PlaceholderText = "";
                            nameRoleField.Description = "The name of the role";
                            nameRoleField.HelpText = "";
                            nameRoleField.Required = true;
                            nameRoleField.Unique = false;
                            nameRoleField.Searchable = false;
                            nameRoleField.Auditable = false;
                            nameRoleField.System = true;
                            nameRoleField.DefaultValue = "";
                            nameRoleField.MaxLength = 200;
                            nameRoleField.EnableSecurity = true;
                            nameRoleField.Permissions = new FieldPermissions();
                            nameRoleField.Permissions.CanRead = new List<Guid>();
                            nameRoleField.Permissions.CanUpdate = new List<Guid>();
                            //READ
                            nameRoleField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                            nameRoleField.Permissions.CanRead.Add(SystemIds.RegularRoleId);
                            //UPDATE
                            nameRoleField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);

                            fieldResponse = entMan.CreateField(roleEntity.Id.Value, nameRoleField, false);

                            InputTextField descriptionRoleField = new InputTextField();

                            descriptionRoleField.Id = new Guid("4A8B9E0A-1C36-40C6-972B-B19E2B5D265B");
                            descriptionRoleField.Name = "description";
                            descriptionRoleField.Label = "Description";
                            descriptionRoleField.PlaceholderText = "";
                            descriptionRoleField.Description = "";
                            descriptionRoleField.HelpText = "";
                            descriptionRoleField.Required = true;
                            descriptionRoleField.Unique = false;
                            descriptionRoleField.Searchable = false;
                            descriptionRoleField.Auditable = false;
                            descriptionRoleField.System = true;
                            descriptionRoleField.DefaultValue = "";

                            descriptionRoleField.MaxLength = 200;

                            fieldResponse = entMan.CreateField(roleEntity.Id.Value, descriptionRoleField, false);
                        }

                        #endregion

                        #region << create user - role relation >>
                        {
                            var userEntity = entMan.ReadEntity(SystemIds.UserEntityId).Object;
                            var roleEntity = entMan.ReadEntity(SystemIds.RoleEntityId).Object;

                            EntityRelation userRoleRelation = new EntityRelation();
                            userRoleRelation.Id = SystemIds.UserRoleRelationId;
                            userRoleRelation.Name = "user_role";
                            userRoleRelation.Label = "User-Role";
                            userRoleRelation.System = true;
                            userRoleRelation.RelationType = EntityRelationType.ManyToMany;
                            userRoleRelation.TargetEntityId = userEntity.Id;
                            userRoleRelation.TargetFieldId = userEntity.Fields.Single(x => x.Name == "id").Id;
                            userRoleRelation.OriginEntityId = roleEntity.Id;
                            userRoleRelation.OriginFieldId = roleEntity.Fields.Single(x => x.Name == "id").Id;
                            {
                                var result = rm.Create(userRoleRelation);
                                if (!result.Success)
                                    throw new Exception("CREATE USER-ROLE RELATION:" + result.Message);
                            }
                        }
                        #endregion

                        #region << create system records >>

                        {
                            EntityRecord user = new EntityRecord();
                            user["id"] = SystemIds.SystemUserId;
                            user["first_name"] = "Local";
                            user["last_name"] = "System";
                            user["password"] = Guid.NewGuid().ToString();
                            user["email"] = "*****@*****.**";
                            user["username"] = "******";
                            user["created_by"] = SystemIds.SystemUserId;
                            user["last_modified_by"] = SystemIds.SystemUserId;
                            user["created_on"] = DateTime.UtcNow;
                            user["enabled"] = true;

                            QueryResponse result = recMan.CreateRecord("user", user);
                            if (!result.Success)
                                throw new Exception("CREATE SYSTEM USER RECORD:" + result.Message);
                        }

                        {
                            EntityRecord user = new EntityRecord();
                            user["id"] = SystemIds.FirstUserId;
                            user["first_name"] = "WebVella";
                            user["last_name"] = "Erp";
                            user["password"] = "******";
                            user["email"] = "*****@*****.**";
                            user["username"] = "******";
                            user["created_by"] = SystemIds.SystemUserId;
                            user["last_modified_by"] = SystemIds.SystemUserId;
                            user["created_on"] = DateTime.UtcNow;
                            user["enabled"] = true;

                            QueryResponse result = recMan.CreateRecord("user", user);
                            if (!result.Success)
                                throw new Exception("CREATE FIRST USER RECORD:" + result.Message);
                        }

                        {
                            EntityRecord adminRole = new EntityRecord();
                            adminRole["id"] = SystemIds.AdministratorRoleId;
                            adminRole["name"] = "administrator";
                            adminRole["description"] = "";
                            adminRole["created_by"] = SystemIds.SystemUserId;
                            adminRole["last_modified_by"] = SystemIds.SystemUserId;
                            adminRole["created_on"] = DateTime.UtcNow;

                            QueryResponse result = recMan.CreateRecord("role", adminRole);
                            if (!result.Success)
                                throw new Exception("CREATE ADMINITRATOR ROLE RECORD:" + result.Message);
                        }

                        {
                            EntityRecord regularRole = new EntityRecord();
                            regularRole["id"] = SystemIds.RegularRoleId;
                            regularRole["name"] = "regular";
                            regularRole["description"] = "";
                            regularRole["created_by"] = SystemIds.SystemUserId;
                            regularRole["last_modified_by"] = SystemIds.SystemUserId;
                            regularRole["created_on"] = DateTime.UtcNow;

                            QueryResponse result = recMan.CreateRecord("role", regularRole);
                            if (!result.Success)
                                throw new Exception("CREATE REGULAR ROLE RECORD:" + result.Message);
                        }

                        {
                            EntityRecord guestRole = new EntityRecord();
                            guestRole["id"] = SystemIds.GuestRoleId;
                            guestRole["name"] = "guest";
                            guestRole["description"] = "";
                            guestRole["created_by"] = SystemIds.SystemUserId;
                            guestRole["last_modified_by"] = SystemIds.SystemUserId;
                            guestRole["created_on"] = DateTime.UtcNow;

                            QueryResponse result = recMan.CreateRecord("role", guestRole);
                            if (!result.Success)
                                throw new Exception("CREATE GUEST ROLE RECORD:" + result.Message);
                        }

                        {
                            QueryResponse result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.AdministratorRoleId, SystemIds.SystemUserId);
                            if (!result.Success)
                                throw new Exception("CREATE SYSTEM-USER <-> ADMINISTRATOR ROLE RELATION RECORD:" + result.Message);

                        }

                        {
                            QueryResponse result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.AdministratorRoleId, SystemIds.FirstUserId);
                            if (!result.Success)
                                throw new Exception("CREATE FIRST-USER <-> ADMINISTRATOR ROLE RELATION RECORD:" + result.Message);

                            result = recMan.CreateRelationManyToManyRecord(SystemIds.UserRoleRelationId, SystemIds.RegularRoleId, SystemIds.FirstUserId);
                            if (!result.Success)
                                throw new Exception("CREATE FIRST-USER <-> REGULAR ROLE RELATION RECORD:" + result.Message);

                        }

                        #endregion

                        #region << create Area entity >>
                        {
                            InputEntity areaEntity = new InputEntity();
                            areaEntity.Id = SystemIds.AreaEntityId;
                            areaEntity.Name = "area";
                            areaEntity.Label = "Area";
                            areaEntity.LabelPlural = "areas";
                            areaEntity.System = true;
                            areaEntity.IconName = "folder";
                            areaEntity.Weight = 10;
                            areaEntity.RecordPermissions = new RecordPermissions();
                            areaEntity.RecordPermissions.CanCreate = new List<Guid>();
                            areaEntity.RecordPermissions.CanRead = new List<Guid>();
                            areaEntity.RecordPermissions.CanUpdate = new List<Guid>();
                            areaEntity.RecordPermissions.CanDelete = new List<Guid>();
                            areaEntity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                            areaEntity.RecordPermissions.CanRead.Add(SystemIds.RegularRoleId);
                            areaEntity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                            areaEntity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                            areaEntity.RecordPermissions.CanDelete.Add(SystemIds.AdministratorRoleId);

                            var systemItemIdDictionary = new Dictionary<string, Guid>();
                            systemItemIdDictionary["id"] = new Guid("19f16bdb-56e6-46bf-8310-2b42fd78be2a");
                            systemItemIdDictionary["created_on"] = new Guid("3e6be69e-8f25-40e4-9f21-86b0d1404230");
                            systemItemIdDictionary["created_by"] = new Guid("16fbba6c-6282-4828-9873-86b8fef745d4");
                            systemItemIdDictionary["last_modified_on"] = new Guid("5f076d8b-e587-4201-9481-67e19789ff6c");
                            systemItemIdDictionary["last_modified_by"] = new Guid("721b27b3-741d-4414-8783-a0245a4eec58");
                            systemItemIdDictionary["user_area_created_by"] = new Guid("5fe5fdc4-ee10-4661-93e7-25ea2a61e710");
                            systemItemIdDictionary["user_area_modified_by"] = new Guid("bb52122c-a354-4668-9423-71dfdc3d9f36");
                            {
                                var createResponse = entMan.CreateEntity(areaEntity, false, false, systemItemIdDictionary);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10330. Message:" + createResponse.Message);
                            }

                            InputTextField color = new InputTextField();
                            color.Id = new Guid("2B4AACD9-3C34-4C44-B3A3-8AFF1520CFF6");
                            color.Name = "color";
                            color.Label = "Color";
                            color.PlaceholderText = "";
                            color.Description = "";
                            color.HelpText = "";
                            color.Required = true;
                            color.Unique = false;
                            color.Searchable = false;
                            color.Auditable = false;
                            color.System = true;
                            color.DefaultValue = "teal";
                            color.MaxLength = null;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, color, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            InputTextField label = new InputTextField();
                            label.Id = new Guid("F050E7A1-AFB7-4346-B57B-1F12B2BD5AE5");
                            label.Name = "label";
                            label.Label = "Label";
                            label.PlaceholderText = "";
                            label.Description = "";
                            label.HelpText = "";
                            label.Required = true;
                            label.Unique = false;
                            label.Searchable = false;
                            label.Auditable = false;
                            label.System = true;
                            label.DefaultValue = "Default";
                            label.MaxLength = null;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, label, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            InputTextField iconName = new InputTextField();
                            iconName.Id = new Guid("5EA0C872-D219-4D94-9EFA-C5DA978D316B");
                            iconName.Name = "icon_name";
                            iconName.Label = "Icon Name";
                            iconName.PlaceholderText = "";
                            iconName.Description = "";
                            iconName.HelpText = "";
                            iconName.Required = true;
                            iconName.Unique = false;
                            iconName.Searchable = false;
                            iconName.Auditable = false;
                            iconName.System = true;
                            iconName.DefaultValue = "database";
                            iconName.MaxLength = null;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, iconName, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            InputNumberField weight = new InputNumberField();
                            weight.Id = new Guid("9B169431-6C31-4141-80EB-5844B8333E63");
                            weight.Name = "weight";
                            weight.Label = "Weight";
                            weight.PlaceholderText = "";
                            weight.Description = "";
                            weight.HelpText = "";
                            weight.Required = true;
                            weight.Unique = false;
                            weight.Searchable = false;
                            weight.Auditable = false;
                            weight.System = true;
                            weight.DefaultValue = 10;
                            weight.MinValue = 0;
                            weight.DecimalPlaces = 2;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, weight, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            InputTextField attachments = new InputTextField();
                            attachments.Id = new Guid("288EA657-C12C-4AC1-B701-81D6F9F39363");
                            attachments.Name = "attachments";
                            attachments.Label = "Attachments JSON String";
                            attachments.PlaceholderText = "";
                            attachments.Description = "Stringified Array of attached objects";
                            attachments.HelpText = "";
                            attachments.Required = false;
                            attachments.Unique = false;
                            attachments.Searchable = false;
                            attachments.Auditable = false;
                            attachments.System = true;
                            attachments.DefaultValue = null;
                            attachments.MaxLength = null;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, attachments, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            InputTextField name = new InputTextField();
                            name.Id = new Guid("F297577B-073E-4D18-81F3-675C1AFB466D");
                            name.Name = "name";
                            name.Label = "Name";
                            name.PlaceholderText = "";
                            name.Description = "";
                            name.HelpText = "";
                            name.Required = true;
                            name.Unique = false;
                            name.Searchable = false;
                            name.Auditable = false;
                            name.System = true;
                            name.DefaultValue = "default";
                            name.MaxLength = null;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, name, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            InputTextField roles = new InputTextField();
                            roles.Id = new Guid("8E486F76-D0C1-4D0E-8617-9EF868BF1C55");
                            roles.Name = "roles";
                            roles.Label = "Roles JSON String";
                            roles.PlaceholderText = "";
                            roles.Description = "Stringified Array of roles that have access to this area";
                            roles.HelpText = "";
                            roles.Required = false;
                            roles.Unique = false;
                            roles.Searchable = false;
                            roles.Auditable = false;
                            roles.System = true;
                            roles.DefaultValue = null;
                            roles.MaxLength = null;
                            {
                                var createResponse = entMan.CreateField(SystemIds.AreaEntityId, roles, false);
                                if (!createResponse.Success)
                                    throw new Exception("System error 10340. Message:" + createResponse.Message);
                            }

                            #region << folder >>
                            {
                                InputTextField textboxField = new InputTextField();
                                textboxField.Id = new Guid("6a0fdf14-2d2b-4c6c-b2f1-4d846c7d5ab8");
                                textboxField.Name = "folder";
                                textboxField.Label = "folder";
                                textboxField.PlaceholderText = "";
                                textboxField.Description = "";
                                textboxField.HelpText = "";
                                textboxField.Required = false;
                                textboxField.Unique = false;
                                textboxField.Searchable = false;
                                textboxField.Auditable = false;
                                textboxField.System = true;
                                textboxField.DefaultValue = string.Empty;
                                textboxField.MaxLength = null;
                                textboxField.EnableSecurity = true;
                                textboxField.Permissions = new FieldPermissions();
                                textboxField.Permissions.CanRead = new List<Guid>();
                                textboxField.Permissions.CanUpdate = new List<Guid>();
                                //READ
                                textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                                //UPDATE
                                textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                                {
                                    var createResponse = entMan.CreateField(SystemIds.AreaEntityId, textboxField, false);
                                    if (!createResponse.Success)
                                        throw new Exception("System error 10060. Entity: area Field: folder" + " Message:" + response.Message);
                                }
                            }
                            #endregion

                        }
                        #endregion
                    }

                    if (currentVersion < 20160430)
                    {
                        systemSettings.Version = 20160430;

                        #region << plugin_data >>
                        var PLUGIN_DATA_ID = new Guid("d928d031-c8b1-4359-be3e-39bceb58f268");
                        var PLUGIN_DATA_NAME = "plugin_data";
                        {
                            #region << entity >>
                            {
                                InputEntity entity = new InputEntity();
                                entity.Id = PLUGIN_DATA_ID;
                                entity.Name = PLUGIN_DATA_NAME;
                                entity.Label = "Plugin Data";
                                entity.LabelPlural = "Plugin Data";
                                entity.System = true;
                                entity.IconName = "database";
                                entity.Weight = 99;
                                entity.RecordPermissions = new RecordPermissions();
                                entity.RecordPermissions.CanCreate = new List<Guid>();
                                entity.RecordPermissions.CanRead = new List<Guid>();
                                entity.RecordPermissions.CanUpdate = new List<Guid>();
                                entity.RecordPermissions.CanDelete = new List<Guid>();
                                //Create
                                entity.RecordPermissions.CanCreate.Add(SystemIds.AdministratorRoleId);
                                //READ
                                entity.RecordPermissions.CanRead.Add(SystemIds.AdministratorRoleId);
                                //UPDATE
                                entity.RecordPermissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                                //DELETE
                                entity.RecordPermissions.CanDelete.Add(SystemIds.AdministratorRoleId);

                                var systemItemIdDictionary = new Dictionary<string, Guid>();
                                systemItemIdDictionary["id"] = new Guid("bdb47d11-b8ee-42e9-8cd1-56e43246656b");
                                systemItemIdDictionary["created_on"] = new Guid("00f172b1-393b-4674-b6cd-32669dfb0924");
                                systemItemIdDictionary["created_by"] = new Guid("89379dbe-98ea-40b0-a794-a7cbf36201af");
                                systemItemIdDictionary["last_modified_on"] = new Guid("aaee0db8-d131-4273-b06a-a788757e24c3");
                                systemItemIdDictionary["last_modified_by"] = new Guid("eb0d2a71-4172-4293-87d7-d238a2153abf");
                                systemItemIdDictionary["user_plugin_data_created_by"] = new Guid("00e3f673-9dbc-4b57-b6d8-38d75e7d165a");
                                systemItemIdDictionary["user_plugin_data_modified_by"] = new Guid("c228125d-066c-415b-8c2a-a43ba2774411");
                                {
                                    var createResponse = entMan.CreateEntity(entity, false, false, systemItemIdDictionary);
                                    if (!createResponse.Success)
                                        throw new Exception("System error 10050. Entity: " + PLUGIN_DATA_NAME + " Field: entity creation" + " Message:" + response.Message);
                                }
                            }
                            #endregion

                            #region << name >>
                            {
                                InputTextField textboxField = new InputTextField();
                                textboxField.Id = new Guid("ab81aec7-da90-4ba8-8ac7-378faa01763f");
                                textboxField.Name = "name";
                                textboxField.Label = "Name";
                                textboxField.PlaceholderText = "";
                                textboxField.Description = "";
                                textboxField.HelpText = "";
                                textboxField.Required = true;
                                textboxField.Unique = true;
                                textboxField.Searchable = false;
                                textboxField.Auditable = false;
                                textboxField.System = true;
                                textboxField.DefaultValue = string.Empty;
                                textboxField.MaxLength = null;
                                textboxField.EnableSecurity = true;
                                textboxField.Permissions = new FieldPermissions();
                                textboxField.Permissions.CanRead = new List<Guid>();
                                textboxField.Permissions.CanUpdate = new List<Guid>();
                                //READ
                                textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                                //UPDATE
                                textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                                {
                                    var createResponse = entMan.CreateField(PLUGIN_DATA_ID, textboxField, false);
                                    if (!createResponse.Success)
                                        throw new Exception("System error 10060. Entity: " + PLUGIN_DATA_NAME + " Field: field_name" + " Message:" + response.Message);
                                }
                            }
                            #endregion

                            #region << data >>
                            {
                                InputTextField textboxField = new InputTextField();
                                textboxField.Id = new Guid("52a799ad-80a3-404b-99b5-1f58ce437982");
                                textboxField.Name = "data";
                                textboxField.Label = "Data";
                                textboxField.PlaceholderText = "";
                                textboxField.Description = "";
                                textboxField.HelpText = "";
                                textboxField.Required = false;
                                textboxField.Unique = false;
                                textboxField.Searchable = false;
                                textboxField.Auditable = false;
                                textboxField.System = true;
                                textboxField.DefaultValue = string.Empty;
                                textboxField.MaxLength = null;
                                textboxField.EnableSecurity = true;
                                textboxField.Permissions = new FieldPermissions();
                                textboxField.Permissions.CanRead = new List<Guid>();
                                textboxField.Permissions.CanUpdate = new List<Guid>();
                                //READ
                                textboxField.Permissions.CanRead.Add(SystemIds.AdministratorRoleId);
                                //UPDATE
                                textboxField.Permissions.CanUpdate.Add(SystemIds.AdministratorRoleId);
                                {
                                    var createResponse = entMan.CreateField(PLUGIN_DATA_ID, textboxField, false);
                                    if (!createResponse.Success)
                                        throw new Exception("System error 10060. Entity: " + PLUGIN_DATA_NAME + " Field: field_name" + " Message:" + response.Message);
                                }
                            }
                            #endregion

                        }
                        #endregion

                    }

                    new DbSystemSettingsRepository().Save(new DbSystemSettings { Id = systemSettings.Id, Version = systemSettings.Version });

                    connection.CommitTransaction();
                }
                catch (Exception ex)
                {
                    var exception = ex;
                    connection.RollbackTransaction();
                    throw;
                }

            }

            //recMan.ConvertNtoNRelations();
        }
Beispiel #23
0
        private bool createSampleRecords = false; //To be enabled requires the CRM sample records

        #endregion Fields

        #region Methods

        public void Start(PluginStartArguments pluginStartArgs)
        {
            //initialize static context
            StaticContext.Initialize(pluginStartArgs.Plugin, pluginStartArgs.ServiceProvider);

            var entMan = new EntityManager();
            var relMan = new EntityRelationManager();
            var recMan = new RecordManager();
            var storeSystemSettings = DbContext.Current.SettingsRepository.Read();
            var systemSettings = new SystemSettings(storeSystemSettings);

            using (SecurityContext.OpenSystemScope())
            {
                //Create transaction
                using (var connection = DbContext.Current.CreateConnection())
                {
                    try
                    {
                        connection.BeginTransaction();

                        //Here we need to initialize or update the environment based on the plugin requirements.
                        //The default place for the plugin data is the "plugin_data" entity -> the "data" text field, which is used to store stringified JSON
                        //containing the plugin settings or version

                        #region << 1.Get the current ERP database version and checks for other plugin dependencies >>
                        if (systemSettings.Version > 0)
                        {
                            //Do something if database version is not what you expect
                        }

                        //This plugin needs the webvella-crm plugin to be installed, so we will check this here
                        var installedPlugins = new PluginService().Plugins;
                        var crmPluginFound = false;
                        foreach (var plugin in installedPlugins)
                        {
                            switch (plugin.Name)
                            {
                                case "webvella-crm":
                                    crmPluginFound = true;
                                    break;
                                default:
                                    break;
                            }
                        }

                        if (!crmPluginFound)
                            throw new Exception("'webvella-crm' plugin is required for the 'webvella-project' to operate");

                        #endregion

                        #region << 2.Get the current plugin settings from the database >>
                        var currentPluginSettings = new PluginSettings();
                        QueryObject pluginDataQueryObject = EntityQuery.QueryEQ("name", WEBVELLA_PROJECT_PLUGIN_NAME);
                        var pluginDataQuery = new EntityQuery("plugin_data", "*", pluginDataQueryObject);
                        var pluginDataQueryResponse = recMan.Find(pluginDataQuery);
                        if (!pluginDataQueryResponse.Success)
                            throw new Exception("plugin 'webvella-project' failed to get its settings due to: " + pluginDataQueryResponse.Message);

                        if (pluginDataQueryResponse.Object == null || !pluginDataQueryResponse.Object.Data.Any() || pluginDataQueryResponse.Object.Data[0]["data"] == DBNull.Value)
                        {
                            //plugin was not installed
                            currentPluginSettings.Version = 20160429;
                            {
                                string json = JsonConvert.SerializeObject(currentPluginSettings);
                                var settingsEntityRecord = new EntityRecord();
                                settingsEntityRecord["id"] = WEBVELLA_PROJECT_PLUGIN_ID;
                                settingsEntityRecord["name"] = WEBVELLA_PROJECT_PLUGIN_NAME;
                                settingsEntityRecord["data"] = json;
                                var settingsSaveReponse = recMan.CreateRecord("plugin_data", settingsEntityRecord);
                                if (!settingsSaveReponse.Success)
                                    throw new Exception("plugin 'webvella-project' failed to save its settings in the database due to: " + pluginDataQueryResponse.Message);
                            }
                        }
                        else
                        {
                            string json = (string)((List<EntityRecord>)pluginDataQueryResponse.Object.Data)[0]["data"];
                            currentPluginSettings = JsonConvert.DeserializeObject<PluginSettings>(json);
                        }
                        #endregion

                        #region << 3. Run methods based on the current installed version of the plugin >>
                        if (currentPluginSettings.Version < 20160430)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160430;
                                Patch160430(entMan,relMan,recMan,createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                var exception = ex;
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160610)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160610;
                                Patch160610(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                var exception = ex;
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160613)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160613;
                                Patch160613(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                var exception = ex;
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160627)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160627;
                                Patch160627(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                var exception = ex;
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160707)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160707;
                                Patch160707(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                var exception = ex;
                                throw ex;
                            }
                        }

                        //if (currentPluginSettings.Version < 20160714)
                        //{
                        //	try
                        //	{
                        //		currentPluginSettings.Version = 20160714;
                        //		Patch160714(entMan, relMan, recMan, createSampleRecords);
                        //	}
                        //	catch (Exception ex)
                        //	{
                        //		var exception = ex;
                        //		throw ex;
                        //	}
                        //}

                        #endregion

                        #region << 4. Save needed changes to the plugin setting data >>
                        {
                            string json = JsonConvert.SerializeObject(currentPluginSettings);
                            var settingsEntityRecord = new EntityRecord();
                            settingsEntityRecord["id"] = WEBVELLA_PROJECT_PLUGIN_ID;
                            settingsEntityRecord["name"] = WEBVELLA_PROJECT_PLUGIN_NAME;
                            settingsEntityRecord["data"] = json;
                            var settingsUpdateReponse = recMan.UpdateRecord("plugin_data", settingsEntityRecord);
                            if (!settingsUpdateReponse.Success)
                                throw new Exception("plugin 'webvella-project' failed to update its settings in the database due to: " + pluginDataQueryResponse.Message);
                        }
                        #endregion

                        connection.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        connection.RollbackTransaction();
                        throw ex;
                    }
                }
            }
        }