/// <summary>
		/// Delete the specified record from the database.
		/// This method should be optimized
		/// </summary>
		/// <param name="record">The record to delete from the database.</param>
		/// <returns>The number of affected records.</returns>
		public int DeleteProductionFormStd( RecProductionFormStd record )
		{
			ProjectManager castSvc = new ProjectManager( );
			int count = castSvc.GetCastCount( record );
			if( count > 0 )
			{
				return 0;
			}

			// Delete form std strands
			RecProductionFormStrandStd strand = new RecProductionFormStrandStd( );
			strand.Factory = record.Factory;
			strand.Project = record.Project;
			strand.Name = record.Name;
			strand.StrandPos = 0;//Means delete all strands related to this form
			ProjectManager svc = new ProjectManager();
			svc.DeleteProductionFormStrandStd( strand );

			// (2) Now delete form
			var delete = new ImpactDelete( ImpProductionFormStd.Instance )
			{
				Where = 
				{
					{ ImpProductionFormStd.Factory.Equal( record.Factory )},
					{ ImpProductionFormStd.Project.Equal( record.Factory )}, //Factory Level, ie(Factory, Factory)
					{ ImpProductionFormStd.Name.Equal( record.Name )},
				}
			};

			string statement = delete.ToString();

			int result;

			using( ImpactDatabase database = new ImpactDatabase() )
			{
				result = database.ExecuteNonQuery( statement );
			}

			return result;
		}