public virtual void Insert(TEntity entity)
        {
            //mappedList.Add(entity);
            TableEntityDTO mapped = CreateDTO(entity);

            mapped.IsDirty = true;

            internalList.Add(mapped);

            //TableOperation insertOperation = TableOperation.Insert(mapped);
            //table.Execute(insertOperation);
        }
        dynamic CreateDTO(object a)
        {
            TableEntityDTO dto    = new TableEntityDTO();
            object         rowKey = null;

            Type t1 = a.GetType();
            Type t2 = dto.GetType();



            //now set all the entity properties
            foreach (System.Reflection.PropertyInfo p in t1.GetProperties())
            {
                Type t = p.PropertyType;

                bool isNested    = t.IsNested;
                bool isEnum      = t.IsEnum;
                bool isGeneric   = t.IsGenericType;
                bool isValueType = t.IsValueType;
                bool isClass     = t.IsClass;

                if (t.IsGenericType && typeof(ICollection <>).IsAssignableFrom(t.GetGenericTypeDefinition()) ||
                    t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ICollection <>)) || t.IsClass)
                {
                    dto.TrySetMember(p.Name, JsonConvert.SerializeObject(p.GetValue(a, null)));
                }
                else
                {
                    dto.TrySetMember(p.Name, p.GetValue(a, null) == null ? "" : p.GetValue(a, null));
                    if (IsId(p.Name))
                    {
                        rowKey = p.GetValue(a, null);
                    }
                }
            }

            if (rowKey == null)
            {
                rowKey = Guid.NewGuid();
            }

            dto.RowKey       = rowKey.ToString();
            dto.PartitionKey = partitionKey;
            dto.Timestamp    = DateTime.Now;


            return(dto);
        }