Function transformFieldsToDatabaseObject