/// <summary>
        /// Saves old version into History table and modifies existing value.
        /// </summary>
        /// <param name="entity">New values of existing project properties.</param>
        /// <param name="author">Author of modification.</param>
        /// <returns>If operation was done.</returns>
        internal static bool ModifyWithHistory(Value entity)
        {
            bool operationSuccess = false;
            ProjectPropertiesEntities db = new ProjectPropertiesEntities();
            if (db.Connection.State != System.Data.ConnectionState.Open)
            {
                db.Connection.Open();
            }
            DbTransaction transaction = db.Connection.BeginTransaction();
            try
            {

                Value oldVersion = db.Values.FirstOrDefault(x => x.Id == entity.Id);
                if (oldVersion == null)
                {
                    throw new IllegalDBOperationException(entity);
                }
                if (oldVersion.Value1.Equals(entity.Value1))
                {
                    return true;
                }
                History forOldVersion = new History(oldVersion);
                db.AddToHistories(forOldVersion);
                if (entity.Important)
                {
                    Project currentProject = db.Projects.FirstOrDefault(x => x.Id == entity.ProjectId);
                    if (currentProject == null)
                    {
                        throw new IllegalDBOperationException(entity);
                    }
                    db.SaveChanges();
                    currentProject.LastChanged = forOldVersion.Id;
                    db.Refresh(RefreshMode.ClientWins, currentProject);
                }
                oldVersion.ModifyItself(entity);
                db.Refresh(RefreshMode.ClientWins, oldVersion);
                db.SaveChanges();
                transaction.Commit();
                operationSuccess = true;
            }
            catch(IllegalDBOperationException e)
            {
                transaction.Rollback();
            }
            catch (Exception e)
            {
                transaction.Rollback();
            }
            finally
            {
                db.Connection.Close();
            }
            return operationSuccess;
        }