public bool InsertCharacteristic(GenericCharacteristic characteristic)
        {
            return AspectF.Define.MustBeNonNull(characteristic).Return<bool>(() =>
            {
                bool succeed = genericCharacteristicRepository.Insert(characteristic);
                if (succeed)
                    cacheManager.RemoveByPattern(Constants.CACHE_GENERICCHARACTERISTIC_PATTERN);

                // event notification

                return succeed;
            });
        }
        public bool SaveCharacteristic(EntityBase entity, string key, string value)
        {
            return AspectF.Define.MustBeNonNull(entity).MustBeNonNullOrEmpty(key).Return<bool>(() =>
            {
                string group = entity.GetUnproxyType().Name; // real type name

                var chs = GetCharacteristicForEntity(entity.Id, group);
                var ch = chs.FirstOrDefault(gch => gch.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase));

                if (null != ch)
                {
                    if (string.IsNullOrWhiteSpace(value))
                    {
                        return DeleteCharacteristic(ch);
                    }
                    else
                    {
                        ch.Value = value;
                        return UpdateCharacteristic(ch);
                    }
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(value))
                    {
                        ch = new GenericCharacteristic(); // create new characteristic
                        ch.EntityId = entity.Id;
                        ch.Key = key;
                        ch.Value = value;
                        ch.Group = group;

                        return InsertCharacteristic(ch);
                    }
                }

                return false; // no data to be saved
            });
        }