/// <summary>Determines whether the <paramref name="newStatusName"/> is unique.</summary> /// <param name="statusId">The ID of the status being renamed, or <c>null</c> for a new status.</param> /// <param name="newStatusName">New name of the status.</param> /// <returns><c>true</c> if the new status name is unique; otherwise, <c>false</c>.</returns> private bool IsStatusNameUnique(int?statusId, string newStatusName) { var newStatusId = UserStatus.GetStatusId(newStatusName, this.PortalId); return(!newStatusId.HasValue || (statusId.HasValue && newStatusId.Value == statusId.Value)); }