Exemplo n.º 1
0
        public async Task <ArtistContract> Create(CreateArtistContract contract)
        {
            ParamIs.NotNull(() => contract);

            if (contract.Names == null || !contract.Names.Any())
            {
                throw new ArgumentException("Artist needs at least one name", "contract");
            }

            VerifyManageDatabase();

            var diff = new ArtistDiff();

            diff.Names.Set();

            return(await repository.HandleTransactionAsync(async ctx => {
                ctx.AuditLogger.SysLog(string.Format("creating a new artist with name '{0}'", contract.Names.First().Value));

                var artist = new Artist {
                    ArtistType = contract.ArtistType,
                    Description = new EnglishTranslatedString(contract.Description.Trim())
                };

                artist.Names.Init(contract.Names, artist);

                if (contract.WebLink != null)
                {
                    artist.CreateWebLink(contract.WebLink.Description, contract.WebLink.Url, contract.WebLink.Category);
                    diff.WebLinks.Set();
                }

                artist.Status = (contract.Draft || !(new ArtistValidator().IsValid(artist))) ? EntryStatus.Draft : EntryStatus.Finished;

                await ctx.SaveAsync(artist);

                if (contract.PictureData != null)
                {
                    var pictureData = contract.PictureData;
                    var parsed = ImageHelper.GetOriginal(pictureData.UploadedFile, pictureData.ContentLength, pictureData.Mime);
                    artist.Picture = new PictureData(parsed);
                    artist.PictureMime = parsed.Mime;

                    pictureData.Id = artist.Id;
                    pictureData.EntryType = EntryType.Artist;
                    var thumbGenerator = new ImageThumbGenerator(imagePersister);
                    thumbGenerator.GenerateThumbsAndMoveImage(pictureData.UploadedFile, pictureData, ImageSizes.Thumb | ImageSizes.SmallThumb | ImageSizes.TinyThumb);

                    diff.Picture.Set();
                }

                var archived = await ArchiveAsync(ctx, artist, diff, ArtistArchiveReason.Created);
                await ctx.UpdateAsync(artist);

                await ctx.AuditLogger.AuditLogAsync(string.Format("created artist {0} ({1})", entryLinkFactory.CreateEntryLink(artist), artist.ArtistType));
                await AddEntryEditedEntryAsync(ctx.OfType <ActivityEntry>(), artist, EntryEditEvent.Created, archived);

                return new ArtistContract(artist, PermissionContext.LanguagePreference);
            }));
        }
Exemplo n.º 2
0
        public void Archive(ISession session, Artist artist, ArtistDiff diff, ArtistArchiveReason reason, string notes = "")
        {
            SysLog("Archiving " + artist);

            var agentLoginData = SessionHelper.CreateAgentLoginData(session, PermissionContext);
            var archived       = ArchivedArtistVersion.Create(artist, diff, agentLoginData, reason, notes);

            session.Save(archived);
        }
Exemplo n.º 3
0
        public void Archive(IRepositoryContext <Artist> ctx, Artist artist, ArtistDiff diff, ArtistArchiveReason reason, string notes = "")
        {
            ctx.AuditLogger.SysLog("Archiving " + artist);

            var agentLoginData = ctx.CreateAgentLoginData(PermissionContext);
            var archived       = ArchivedArtistVersion.Create(artist, diff, agentLoginData, reason, notes);

            ctx.Save(archived);
        }
Exemplo n.º 4
0
        public ArchivedArtistContract(Artist artist, ArtistDiff diff)
        {
            ParamIs.NotNull(() => artist);

            Albums         = (diff.IncludeAlbums ? artist.Albums.Select(a => new ObjectRefContract(a.Album)).ToArray() : null);
            ArtistType     = artist.ArtistType;
            Id             = artist.Id;
            Description    = (diff.IncludeDescription ? artist.Description : null);
            Groups         = artist.Groups.Select(g => new ObjectRefContract(g.Group)).ToArray();
            Members        = artist.Members.Select(m => new ObjectRefContract(m.Member)).ToArray();
            Names          = (diff.IncludeNames ? artist.Names.Names.Select(n => new LocalizedStringContract(n)).ToArray() : null);
            Pictures       = (diff.IncludePictures ? artist.Pictures.Select(p => new ArchivedEntryPictureFileContract(p)).ToArray() : null);
            TranslatedName = new TranslatedStringContract(artist.TranslatedName);
            WebLinks       = (diff.IncludeWebLinks ? artist.WebLinks.Select(l => new ArchivedWebLinkContract(l)).ToArray() : null);
        }
Exemplo n.º 5
0
        public ArchivedArtistContract(Artist artist, ArtistDiff diff)
        {
            ParamIs.NotNull(() => artist);

            ArtistType      = artist.ArtistType;
            BaseVoicebank   = ObjectRefContract.Create(artist.BaseVoicebank);
            Id              = artist.Id;
            Description     = (diff.IncludeDescription ? artist.Description.Original : null);
            DescriptionEng  = (diff.IncludeDescription ? artist.Description.English : null);
            Groups          = artist.Groups.Select(g => new ArchivedArtistForArtistContract(g)).ToArray();
            MainPictureMime = artist.PictureMime;
            Members         = artist.Members.Select(m => new ObjectRefContract(m.Member)).ToArray();
            Names           = (diff.IncludeNames ? artist.Names.Names.Select(n => new LocalizedStringContract(n)).ToArray() : null);
            Pictures        = (diff.IncludePictures ? artist.Pictures.Select(p => new ArchivedEntryPictureFileContract(p)).ToArray() : null);
            ReleaseDate     = artist.ReleaseDate;
            TranslatedName  = new TranslatedStringContract(artist.TranslatedName);
            WebLinks        = (diff.IncludeWebLinks ? artist.WebLinks.Select(l => new ArchivedWebLinkContract(l)).ToArray() : null);
        }
Exemplo n.º 6
0
        public async Task <int> Update(ArtistForEditContract properties, EntryPictureFileContract pictureData, IUserPermissionContext permissionContext)
        {
            ParamIs.NotNull(() => properties);
            ParamIs.NotNull(() => permissionContext);

            return(await repository.HandleTransactionAsync(async ctx => {
                var artist = await ctx.LoadAsync(properties.Id);

                VerifyEntryEdit(artist);

                var diff = new ArtistDiff(DoSnapshot(artist.GetLatestVersion(), await ctx.OfType <User>().GetLoggedUserAsync(permissionContext)));

                ctx.AuditLogger.SysLog(string.Format("updating properties for {0}", artist));

                if (artist.ArtistType != properties.ArtistType)
                {
                    artist.ArtistType = properties.ArtistType;
                    diff.ArtistType.Set();
                }

                diff.Description.Set(artist.Description.CopyFrom(properties.Description));

                if (artist.TranslatedName.DefaultLanguage != properties.DefaultNameLanguage)
                {
                    artist.TranslatedName.DefaultLanguage = properties.DefaultNameLanguage;
                    diff.OriginalName.Set();
                }

                // Required because of a bug in NHibernate
                NHibernateUtil.Initialize(artist.Picture);

                if (pictureData != null)
                {
                    var parsed = ImageHelper.GetOriginal(pictureData.UploadedFile, pictureData.ContentLength, pictureData.Mime);
                    artist.Picture = new PictureData(parsed);
                    artist.PictureMime = parsed.Mime;

                    pictureData.Id = artist.Id;
                    pictureData.EntryType = EntryType.Artist;
                    var thumbGenerator = new ImageThumbGenerator(imagePersister);
                    thumbGenerator.GenerateThumbsAndMoveImage(pictureData.UploadedFile, pictureData, ImageSizes.Thumb | ImageSizes.SmallThumb | ImageSizes.TinyThumb);

                    diff.Picture.Set();
                }

                if (artist.Status != properties.Status)
                {
                    artist.Status = properties.Status;
                    diff.Status.Set();
                }

                var nameDiff = artist.Names.Sync(properties.Names, artist);
                await ctx.OfType <ArtistName>().SyncAsync(nameDiff);

                if (nameDiff.Changed)
                {
                    diff.Names.Set();
                }

                if (!artist.BaseVoicebank.NullSafeIdEquals(properties.BaseVoicebank))
                {
                    var newBase = await ctx.NullSafeLoadAsync(properties.BaseVoicebank);

                    if (artist.IsValidBaseVoicebank(newBase))
                    {
                        diff.BaseVoicebank.Set();
                        artist.SetBaseVoicebank(await ctx.NullSafeLoadAsync(properties.BaseVoicebank));
                    }
                }

                if (!artist.ReleaseDate.Equals(properties.ReleaseDate))
                {
                    artist.ReleaseDate = properties.ReleaseDate;
                    diff.ReleaseDate.Set();
                }

                var webLinkDiff = WebLink.Sync(artist.WebLinks, properties.WebLinks, artist);
                await ctx.OfType <ArtistWebLink>().SyncAsync(webLinkDiff);

                if (webLinkDiff.Changed)
                {
                    diff.WebLinks.Set();
                }

                if (diff.ArtistType.IsChanged || diff.Names.IsChanged || diff.OriginalName.IsChanged)
                {
                    foreach (var song in artist.Songs)
                    {
                        song.Song.UpdateArtistString();
                        await ctx.UpdateAsync(song);
                    }
                }

                var newGroups = properties.Groups
                                .Select(g => new ArtistForArtistContract {
                    Parent = g.Parent, LinkType = ArtistLinkType.Group
                })
                                .Concat(new[] {
                    new ArtistForArtistContract {
                        Parent = properties.Illustrator, LinkType = ArtistLinkType.Illustrator
                    },
                    new ArtistForArtistContract {
                        Parent = properties.VoiceProvider, LinkType = ArtistLinkType.VoiceProvider
                    }
                })
                                .Concat(properties.AssociatedArtists)
                                .Where(a => a.Parent != null && ArtistHelper.CanHaveRelatedArtists(artist.ArtistType, a.LinkType, LinkDirection.ManyToOne))
                                .ToArray();

                var groupsDiff = CollectionHelper.Diff(artist.Groups, newGroups, (i, i2) => (i.Parent.Id == i2.Parent.Id && i.LinkType == i2.LinkType));

                foreach (var grp in groupsDiff.Removed)
                {
                    grp.Delete();
                    await ctx.DeleteAsync(grp);
                }

                foreach (var grp in groupsDiff.Added)
                {
                    var link = artist.AddGroup(ctx.Load(grp.Parent.Id), grp.LinkType);
                    await ctx.SaveAsync(link);
                }

                if (groupsDiff.Changed)
                {
                    diff.Groups.Set();
                }

                var picsDiff = artist.Pictures.SyncPictures(properties.Pictures, ctx.OfType <User>().GetLoggedUser(permissionContext), artist.CreatePicture);
                ctx.OfType <ArtistPictureFile>().Sync(picsDiff);
                var entryPictureFileThumbGenerator = new ImageThumbGenerator(pictureFilePersister);
                artist.Pictures.GenerateThumbsAndMoveImage(entryPictureFileThumbGenerator, picsDiff.Added, ImageSizes.Original | ImageSizes.Thumb);

                if (picsDiff.Changed)
                {
                    diff.Pictures.Set();
                }

                var logStr = string.Format("updated properties for artist {0} ({1})", entryLinkFactory.CreateEntryLink(artist), diff.ChangedFieldsString)
                             + (properties.UpdateNotes != string.Empty ? " " + properties.UpdateNotes : string.Empty)
                             .Truncate(400);

                var archived = await ArchiveAsync(ctx, artist, diff, ArtistArchiveReason.PropertiesUpdated, properties.UpdateNotes);
                await ctx.UpdateAsync(artist);

                await ctx.AuditLogger.AuditLogAsync(logStr);
                await AddEntryEditedEntryAsync(ctx.OfType <ActivityEntry>(), artist, EntryEditEvent.Updated, archived);

                return artist.Id;
            }));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Reverts an album to an earlier archived version.
        /// </summary>
        /// <param name="archivedArtistVersionId">Id of the archived version to be restored.</param>
        /// <returns>Result of the revert operation, with possible warnings if any. Cannot be null.</returns>
        /// <remarks>Requires the RestoreRevisions permission.</remarks>
        public async Task <EntryRevertedContract> RevertToVersion(int archivedArtistVersionId)
        {
            PermissionContext.VerifyPermission(PermissionToken.RestoreRevisions);

            return(await HandleTransactionAsync(async session => {
                var archivedVersion = await session.LoadAsync <ArchivedArtistVersion>(archivedArtistVersionId);

                if (archivedVersion.Hidden)
                {
                    PermissionContext.VerifyPermission(PermissionToken.ViewHiddenRevisions);
                }

                var artist = archivedVersion.Artist;

                session.AuditLogger.SysLog("reverting " + artist + " to version " + archivedVersion.Version);

                var fullProperties = ArchivedArtistContract.GetAllProperties(archivedVersion);
                var warnings = new List <string>();
                var diff = new ArtistDiff();

                artist.ArtistType = fullProperties.ArtistType;
                artist.Description.Original = fullProperties.Description;
                artist.Description.English = fullProperties.DescriptionEng ?? string.Empty;
                artist.TranslatedName.DefaultLanguage = fullProperties.TranslatedName.DefaultLanguage;
                artist.BaseVoicebank = DatabaseContextHelper.RestoreWeakRootEntityRef(session, warnings, fullProperties.BaseVoicebank);

                // Picture
                var versionWithPic = archivedVersion.GetLatestVersionWithField(ArtistEditableFields.Picture);

                if (versionWithPic != null)
                {
                    artist.Picture = versionWithPic.Picture;
                    artist.PictureMime = versionWithPic.PictureMime;

                    if (versionWithPic.Picture != null)
                    {
                        var thumbGenerator = new ImageThumbGenerator(imagePersister);
                        using (var stream = new MemoryStream(versionWithPic.Picture.Bytes)) {
                            var thumb = new EntryThumb(artist, versionWithPic.PictureMime, ImagePurpose.Main);
                            thumbGenerator.GenerateThumbsAndMoveImage(stream, thumb, ImageSizes.Thumb | ImageSizes.SmallThumb | ImageSizes.TinyThumb);
                        }
                    }
                }
                else
                {
                    artist.Picture = null;
                    artist.PictureMime = null;
                }

                // Assume picture was changed if there's a version between the current version and the restored version where the picture was changed.
                diff.Picture.Set(!Equals(artist.ArchivedVersionsManager.GetLatestVersionWithField(ArtistEditableFields.Picture, artist.Version), versionWithPic));

                // Groups
                DatabaseContextHelper.RestoreObjectRefs(
                    session, warnings, artist.AllGroups, fullProperties.Groups, (a1, a2) => (a1.Parent.Id == a2.Id),
                    (grp, grpRef) => (!artist.HasGroup(grp) ? artist.AddGroup(grp, grpRef.LinkType) : null),
                    groupForArtist => groupForArtist.Delete());

                // Names
                if (fullProperties.Names != null)
                {
                    var nameDiff = artist.Names.SyncByContent(fullProperties.Names, artist);
                    await session.SyncAsync(nameDiff);
                }

                // Weblinks
                if (fullProperties.WebLinks != null)
                {
                    var webLinkDiff = WebLink.SyncByValue(artist.WebLinks, fullProperties.WebLinks, artist);
                    await session.SyncAsync(webLinkDiff);
                }

                await ArchiveAsync(session, artist, diff, ArtistArchiveReason.Reverted, string.Format("Reverted to version {0}", archivedVersion.Version));
                await AuditLogAsync(string.Format("reverted {0} to revision {1}", entryLinkFactory.CreateEntryLink(artist), archivedVersion.Version), session);

                return new EntryRevertedContract(artist, warnings);
            }));
        }
Exemplo n.º 8
0
        public async Task <ArchivedArtistVersion> ArchiveAsync(IDatabaseContext <Artist> ctx, Artist artist, ArtistDiff diff, ArtistArchiveReason reason, string notes = "")
        {
            ctx.AuditLogger.SysLog("Archiving " + artist);

            var agentLoginData = await ctx.CreateAgentLoginDataAsync(PermissionContext);

            var archived = ArchivedArtistVersion.Create(artist, diff, agentLoginData, reason, notes);
            await ctx.SaveAsync(archived);

            return(archived);
        }
Exemplo n.º 9
0
        public int Update(ArtistForEditContract properties, EntryPictureFileContract pictureData, IUserPermissionContext permissionContext)
        {
            ParamIs.NotNull(() => properties);
            ParamIs.NotNull(() => permissionContext);

            return(repository.HandleTransaction(ctx => {
                var artist = ctx.Load(properties.Id);

                VerifyEntryEdit(artist);

                var diff = new ArtistDiff(DoSnapshot(artist.GetLatestVersion(), ctx.OfType <User>().GetLoggedUser(permissionContext)));

                ctx.AuditLogger.SysLog(string.Format("updating properties for {0}", artist));

                if (artist.ArtistType != properties.ArtistType)
                {
                    artist.ArtistType = properties.ArtistType;
                    diff.ArtistType = true;
                }

                if (artist.Description != properties.Description)
                {
                    artist.Description = properties.Description;
                    diff.Description = true;
                }

                if (artist.TranslatedName.DefaultLanguage != properties.DefaultNameLanguage)
                {
                    artist.TranslatedName.DefaultLanguage = properties.DefaultNameLanguage;
                    diff.OriginalName = true;
                }

                // Required because of a bug in NHibernate
                NHibernateUtil.Initialize(artist.Picture);

                if (pictureData != null)
                {
                    var parsed = ImageHelper.GetOriginal(pictureData.UploadedFile, pictureData.ContentLength, pictureData.Mime);
                    artist.Picture = new PictureData(parsed);
                    artist.PictureMime = parsed.Mime;

                    pictureData.Id = artist.Id;
                    pictureData.EntryType = EntryType.Artist;
                    var thumbGenerator = new ImageThumbGenerator(imagePersister);
                    thumbGenerator.GenerateThumbsAndMoveImage(pictureData.UploadedFile, pictureData, ImageSizes.Thumb | ImageSizes.SmallThumb | ImageSizes.TinyThumb);

                    diff.Picture = true;
                }

                if (artist.Status != properties.Status)
                {
                    artist.Status = properties.Status;
                    diff.Status = true;
                }

                var nameDiff = artist.Names.Sync(properties.Names, artist);
                ctx.OfType <ArtistName>().Sync(nameDiff);

                if (nameDiff.Changed)
                {
                    diff.Names = true;
                }

                if (!artist.BaseVoicebank.NullSafeIdEquals(properties.BaseVoicebank))
                {
                    var newBase = ctx.NullSafeLoad(properties.BaseVoicebank);

                    if (artist.IsValidBaseVoicebank(newBase))
                    {
                        diff.BaseVoicebank = true;
                        artist.SetBaseVoicebank(ctx.NullSafeLoad(properties.BaseVoicebank));
                    }
                }

                var validWebLinks = properties.WebLinks.Where(w => !string.IsNullOrEmpty(w.Url));
                var webLinkDiff = WebLink.Sync(artist.WebLinks, validWebLinks, artist);
                ctx.OfType <ArtistWebLink>().Sync(webLinkDiff);

                if (webLinkDiff.Changed)
                {
                    diff.WebLinks = true;
                }

                if (diff.ArtistType || diff.Names)
                {
                    foreach (var song in artist.Songs)
                    {
                        song.Song.UpdateArtistString();
                        ctx.Update(song);
                    }
                }

                var groupsDiff = CollectionHelper.Diff(artist.Groups, properties.Groups, (i, i2) => (i.Id == i2.Id));

                foreach (var grp in groupsDiff.Removed)
                {
                    grp.Delete();
                    ctx.Delete(grp);
                }

                foreach (var grp in groupsDiff.Added)
                {
                    var link = artist.AddGroup(ctx.Load(grp.Group.Id));
                    ctx.Save(link);
                }

                if (groupsDiff.Changed)
                {
                    diff.Groups = true;
                }

                var picsDiff = artist.Pictures.SyncPictures(properties.Pictures, ctx.OfType <User>().GetLoggedUser(permissionContext), artist.CreatePicture);
                ctx.OfType <ArtistPictureFile>().Sync(picsDiff);
                ImageHelper.GenerateThumbsAndMoveImages(picsDiff.Added);

                if (picsDiff.Changed)
                {
                    diff.Pictures = true;
                }

                var logStr = string.Format("updated properties for artist {0} ({1})", entryLinkFactory.CreateEntryLink(artist), diff.ChangedFieldsString)
                             + (properties.UpdateNotes != string.Empty ? " " + properties.UpdateNotes : string.Empty)
                             .Truncate(400);

                ctx.AuditLogger.AuditLog(logStr);
                AddEntryEditedEntry(ctx.OfType <ActivityEntry>(), artist, EntryEditEvent.Updated);

                Archive(ctx, artist, diff, ArtistArchiveReason.PropertiesUpdated, properties.UpdateNotes);
                ctx.Update(artist);

                return artist.Id;
            }));
        }
Exemplo n.º 10
0
        public void UpdateBasicProperties(ArtistForEditContract properties, PictureDataContract pictureData, IUserPermissionContext permissionContext)
        {
            ParamIs.NotNull(() => properties);
            ParamIs.NotNull(() => permissionContext);

            HandleTransaction(session => {
                var artist = session.Load <Artist>(properties.Id);

                VerifyEntryEdit(artist);

                var diff = new ArtistDiff(DoSnapshot(artist.GetLatestVersion(), GetLoggedUser(session)));

                SysLog(string.Format("updating properties for {0}", artist));

                if (artist.ArtistType != properties.ArtistType)
                {
                    artist.ArtistType = properties.ArtistType;
                    diff.ArtistType   = true;
                }

                if (artist.Description != properties.Description)
                {
                    artist.Description = properties.Description;
                    diff.Description   = true;
                }

                if (artist.TranslatedName.DefaultLanguage != properties.TranslatedName.DefaultLanguage)
                {
                    artist.TranslatedName.DefaultLanguage = properties.TranslatedName.DefaultLanguage;
                    diff.OriginalName = true;
                }

                NHibernateUtil.Initialize(artist.Picture);
                if (pictureData != null)
                {
                    artist.Picture = new PictureData(pictureData);
                    diff.Picture   = true;
                }

                if (artist.Status != properties.Status)
                {
                    artist.Status = properties.Status;
                    diff.Status   = true;
                }

                var nameDiff = artist.Names.Sync(properties.Names.AllNames, artist);
                SessionHelper.Sync(session, nameDiff);

                if (nameDiff.Changed)
                {
                    diff.Names = true;
                }

                var validWebLinks = properties.WebLinks.Where(w => !string.IsNullOrEmpty(w.Url));
                var webLinkDiff   = WebLink.Sync(artist.WebLinks, validWebLinks, artist);
                SessionHelper.Sync(session, webLinkDiff);

                if (webLinkDiff.Changed)
                {
                    diff.WebLinks = true;
                }

                if (diff.ArtistType || diff.Names)
                {
                    foreach (var song in artist.Songs)
                    {
                        song.Song.UpdateArtistString();
                        session.Update(song);
                    }
                }

                var groupsDiff = CollectionHelper.Diff(artist.Groups, properties.Groups, (i, i2) => (i.Id == i2.Id));

                foreach (var grp in groupsDiff.Removed)
                {
                    grp.Delete();
                    session.Delete(grp);
                }

                foreach (var grp in groupsDiff.Added)
                {
                    var link = artist.AddGroup(session.Load <Artist>(grp.Group.Id));
                    session.Save(link);
                }

                if (groupsDiff.Changed)
                {
                    diff.Groups = true;
                }

                var picsDiff = artist.Pictures.SyncPictures(properties.Pictures, GetLoggedUser(session), artist.CreatePicture);
                SessionHelper.Sync(session, picsDiff);
                ImageHelper.GenerateThumbsAndMoveImages(picsDiff.Added);

                if (picsDiff.Changed)
                {
                    diff.Pictures = true;
                }

                /*
                 * var albumGetter = new Func<AlbumForArtistEditContract, Album>(contract => {
                 *
                 *      Album album;
                 *
                 *      if (contract.AlbumId != 0) {
                 *
                 *              album = session.Load<Album>(contract.AlbumId);
                 *
                 *      } else {
                 *
                 *              AuditLog(string.Format("creating a new album '{0}' to {1}", contract.AlbumName, artist));
                 *
                 *              album = new Album(contract.AlbumName);
                 *              session.Save(album);
                 *
                 *              Services.Albums.Archive(session, album, AlbumArchiveReason.Created,
                 *                      string.Format("Created for artist '{0}'", artist.DefaultName));
                 *
                 *              AuditLog(string.Format("created {0} for {1}",
                 *                      EntryLinkFactory.CreateEntryLink(album), EntryLinkFactory.CreateEntryLink(artist)), session);
                 *              AddEntryEditedEntry(session, album, EntryEditEvent.Created);
                 *
                 *      }
                 *
                 *      return album;
                 *
                 * });
                 *
                 * if (properties.AlbumLinks != null
                 *      && !properties.TooManyAlbums
                 *      && (properties.AlbumLinks.Any() || artist.Albums.Count() < ArtistForEditContract.MaxAlbums / 2)
                 *      && artist.Albums.Count() <= ArtistForEditContract.MaxAlbums) {
                 *
                 *      var albumDiff = artist.SyncAlbums(properties.AlbumLinks, albumGetter);
                 *
                 *      SessionHelper.Sync(session, albumDiff);
                 *
                 *      if (albumDiff.Changed) {
                 *
                 *              diff.Albums = true;
                 *
                 *              var add = string.Join(", ", albumDiff.Added.Select(i => i.Album.ToString()));
                 *              var rem = string.Join(", ", albumDiff.Removed.Select(i => i.Album.ToString()));
                 *
                 *              var str = string.Format("edited albums (added: {0}, removed: {1})", add, rem)
                 *                      .Truncate(300);
                 *
                 *              AuditLog(str, session);
                 *
                 *      }
                 *
                 * }*/

                var logStr = string.Format("updated properties for {0} ({1})", EntryLinkFactory.CreateEntryLink(artist), diff.ChangedFieldsString)
                             + (properties.UpdateNotes != string.Empty ? " " + properties.UpdateNotes : string.Empty)
                             .Truncate(400);

                AuditLog(logStr, session);
                AddEntryEditedEntry(session, artist, EntryEditEvent.Updated);

                Archive(session, artist, diff, ArtistArchiveReason.PropertiesUpdated, properties.UpdateNotes);
                session.Update(artist);

                return(true);
            });
        }