public coreModel.DynamicContentItem CreateContent(coreModel.DynamicContentItem content)
		{
			var entity = content.ToDataModel();
			coreModel.DynamicContentItem retVal = null;
			using (var repository = _repositoryFactory())
			{
				repository.Add(entity);
				CommitChanges(repository);
			}
			retVal = GetContentItemById(entity.Id);
			return retVal;
		}
        public coreModel.DynamicContentItem CreateContent(coreModel.DynamicContentItem content)
        {
            var entity = content.ToDataModel();

            using (var repository = _repositoryFactory())
            {
                repository.Add(entity);
                CommitChanges(repository);
            }

            content.SetObjectId(entity.Id);
            _dynamicPropertyService.SaveDynamicPropertyValues(content);

            var retVal = GetContentItemById(entity.Id);
            return retVal;
        }
        public coreModel.DynamicContentItem CreateContent(coreModel.DynamicContentItem content)
        {
            var pkMap = new PrimaryKeyResolvingMap();
            var entity = content.ToDataModel(pkMap);

            using (var repository = _repositoryFactory())
            {
                repository.Add(entity);
                CommitChanges(repository);
                pkMap.ResolvePrimaryKeys();
            }

            _dynamicPropertyService.SaveDynamicPropertyValues(content);

            var retVal = GetContentItemById(entity.Id);
            return retVal;
        }
		public void UpdateFolder(coreModel.DynamicContentFolder folder)
		{
			using (var repository = _repositoryFactory())
			using (var changeTracker = base.GetChangeTracker(repository))
			{
				var sourceEntity = folder.ToDataModel();
				var targetEntity = repository.GetContentFolderById(folder.Id);
				if (targetEntity == null)
				{
					repository.Add(sourceEntity);
				}
				else
				{
					changeTracker.Attach(targetEntity);
					sourceEntity.Patch(targetEntity);
				}
				CommitChanges(repository);
			}
		}
		public coreModel.DynamicContentFolder CreateFolder(coreModel.DynamicContentFolder folder)
		{
			var entity = folder.ToDataModel();
			coreModel.DynamicContentFolder retVal = null;
			using (var repository = _repositoryFactory())
			{
				repository.Add(entity);
				CommitChanges(repository);
			}
			retVal = GetFolderById(entity.Id);
			return retVal;
		}
		public coreModel.DynamicContentPublication CreatePublication(coreModel.DynamicContentPublication publication)
		{
			var entity = publication.ToDataModel();
			coreModel.DynamicContentPublication retVal = null;
			using (var repository = _repositoryFactory())
			{
				repository.Add(entity);
				CommitChanges(repository);
			}
			retVal = GetPublicationById(entity.Id);
			return retVal;
		}
		public coreModel.DynamicContentPlace CreatePlace(coreModel.DynamicContentPlace place)
		{
			var entity = place.ToDataModel();
			coreModel.DynamicContentPlace retVal = null;
			using (var repository = _repositoryFactory())
			{
				repository.Add(entity);
				CommitChanges(repository);
			}
			retVal = GetPlaceById(entity.Id);
			return retVal;
		}
 public void UpdatePlace(coreModel.DynamicContentPlace place)
 {
     using (var repository = _repositoryFactory())
     using (var changeTracker = GetChangeTracker(repository))
     {
         var sourceEntity = place.ToDataModel();
         var targetEntity = repository.GetContentPlaceById(place.Id);
         if (targetEntity == null)
         {
             repository.Add(sourceEntity);
         }
         else
         {
             changeTracker.Attach(targetEntity);
             sourceEntity.Patch(targetEntity);
         }
         CommitChanges(repository);
     }
 }