Edited and refactored Serialize DB's writeSerializableObject function.