protected override bool OnValidate()
        {
            if (ModuleBoxes == null)
            {
                AddMessage(nameof(Title) + GetErrorMessageSufix(), new Message("Attempted to save box to non-existing boxes module", MessageTypes.Error));
                return(false);
            }

            _box = ModuleBoxesBox.Query.SingleOrDefault(mbb => mbb.Id == Id && mbb.ModuleBoxesId == ModuleBoxes.Id);
            if (Id != 0 && _box == null)
            {
                AddMessage(nameof(Title) + GetErrorMessageSufix(), new Message("Box does not belong to current box module or does not exist", MessageTypes.Error));
                return(false);
            }

            return(true);
        }
        protected override void OnSubmit(NTGDBTransactional transaction)
        {
            if (IsDelete)
            {
                if (Id != 0)
                {
                    _box.Delete(transaction);
                }
            }
            else
            {
                _box               = _box ?? new ModuleBoxesBox();
                _box.Title         = Title;
                _box.Icon          = Icon;
                _box.Color         = Color;
                _box.Text          = Text;
                _box.Url           = Url;
                _box.Position      = Position;
                _box.ModuleBoxesId = ModuleBoxes.Id;
                _box.Save(transaction);

                Id = _box.Id;
            }
        }