private byte[] SerializeHistory(Dictionary<Guid, HistoryCategory> categories)
{
MemoryStream stream = new MemoryStream();
try {
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, categories);
return stream.ToArray();
}
catch(Exception e) {
Debug.ReportError("Error while serializing task history. Exception: {0}", e.Message);
return null;
}
finally {
if(stream != null) {
stream.Close();
}
}
}